@stakekit/widget 0.0.273 → 0.0.274

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/bundle/index.bundle.js +7 -7
  2. package/dist/package/index.package.js +1951 -1746
  3. package/dist/types/domain/types/yields.d.ts +2 -1
  4. package/dist/types/hooks/api/use-dashboard-yield-catalog.d.ts +20 -0
  5. package/dist/types/hooks/api/use-token-list-yields.d.ts +11 -1
  6. package/dist/types/hooks/api/use-yield-summaries.d.ts +50 -0
  7. package/dist/types/pages/details/earn-page/components/select-token-section/select-token-list-item.d.ts +3 -1
  8. package/dist/types/pages/details/earn-page/state/types.d.ts +9 -1
  9. package/dist/website/assets/{basic-Bo7SBwII.js → basic-BVJnMIHl.js} +1 -1
  10. package/dist/website/assets/{basic-ThspdnuL.js → basic-CibIan8y.js} +1 -1
  11. package/dist/website/assets/{browser-DskDvf4V.js → browser--EMMYaan.js} +1 -1
  12. package/dist/website/assets/{build-DN0pJtdR.js → build-BPw0SHWb.js} +1 -1
  13. package/dist/website/assets/{build-BmJ27Vry.js → build-DFEPAT8y.js} +1 -1
  14. package/dist/website/assets/{cardano-connector-B2Ea9uXJ.js → cardano-connector-CbHZBb34.js} +1 -1
  15. package/dist/website/assets/{core-BFFu4TZK.js → core-BSLy_t4A.js} +2 -2
  16. package/dist/website/assets/{dist-BC-yZnz1.js → dist-BRCQU1Li.js} +1 -1
  17. package/dist/website/assets/{dist-DwMZ-Epn.js → dist-DAbkzFAO.js} +1 -1
  18. package/dist/website/assets/en_US-IFPOGBSL-BzV0u3lE.js +1 -0
  19. package/dist/website/assets/{esm-Bvq2M2B2.js → esm-FztE-O2S.js} +1 -1
  20. package/dist/website/assets/{exports-BEqJeoxC.js → exports-DiWzDOxG.js} +1 -1
  21. package/dist/website/assets/index-BIOEiLJw.js +2044 -0
  22. package/dist/website/assets/{index.es-qQnPYJtJ.js → index.es-D3Xa7Qme.js} +2 -2
  23. package/dist/website/assets/{ledger-connector-C520fQQY.js → ledger-connector-6wqonZoy.js} +1 -1
  24. package/dist/website/assets/{receive-Dcx0aHWA.js → receive-BN_rE1dd.js} +1 -1
  25. package/dist/website/assets/{registry-CvkKYDcW.js → registry-DLj0P6dj.js} +1 -1
  26. package/dist/website/assets/{safe-connector-CDGYW3b8.js → safe-connector-NQlNJxmf.js} +1 -1
  27. package/dist/website/assets/{socials-BDwTFvCa.js → socials-C3M2JNCz.js} +1 -1
  28. package/dist/website/assets/{solana-connector-BcHaSaSq.js → solana-connector-hzwYOzto.js} +1 -1
  29. package/dist/website/assets/{substrate-connector-DxYe9s4o.js → substrate-connector-CCxDFYG6.js} +1 -1
  30. package/dist/website/assets/{ton-connector-sD5IEuy2.js → ton-connector-DlVKNF8w.js} +1 -1
  31. package/dist/website/assets/{tron-connector-DgBR_biA.js → tron-connector-C6xS9wMC.js} +3 -3
  32. package/dist/website/assets/tx-CXZ9mGxZ.js +1 -0
  33. package/dist/website/assets/{wallet-manager-4JkYZ_Wn.js → wallet-manager-BxPcB4lR.js} +3 -3
  34. package/dist/website/assets/{wui-qr-code-CadVdoQK.js → wui-qr-code-CNh2d2fT.js} +1 -1
  35. package/dist/website/index.html +1 -1
  36. package/package.json +1 -1
  37. package/dist/website/assets/en_US-IFPOGBSL-DY8aJwVh.js +0 -1
  38. package/dist/website/assets/index-DTVV95ia.js +0 -2044
  39. package/dist/website/assets/tx-Cjn1Xzt5.js +0 -1
@@ -1,2 +1,2 @@
1
- import{t as e}from"./chunk-CzyJ72yW.js";import{C as t,G as n,K as r,O as i,T as a,U as o,W as s,n as c,t as l}from"./createConnector-BcHSC56W.js";import{i as u,t as d}from"./dist-rLdy04_b.js";import{t as f}from"./toBytes-DiTqRJTE.js";import{a as p,n as m,r as h,t as g}from"./networks-CWeJ1anG.js";import{c as _,s as v,t as y}from"./Transport-D-_yOZ73.js";import{$ as b,C as x,D as S,O as C,T as ee,at as w,et as te,it as T,rt as E,w as D,x as ne}from"./index-DTVV95ia.js";import{t as re}from"./v4-BcCgZyuS.js";import{n as ie,t as ae}from"./dist-Dtx-4lnI.js";import{t as oe}from"./registry-CvkKYDcW.js";var se=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ce=Math.ceil,le=Math.floor,O=`[BigNumber Error] `,ue=O+`Number primitive has more than 15 significant digits: `,de=0x5af3107a4000,k=14,fe=9007199254740991,pe=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],me=1e7,A=1e9;function he(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!se.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(j(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(ue+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>fe||e!==le(e)))throw Error(ue+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%k,l<0&&(f+=k),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=k;f<m;)y.c.push(+h.slice(f,f+=k));f=k-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=he,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],j(n,0,A,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],j(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(j(n[0],-A,0,t),j(n[1],0,A,t),c=n[0],l=n[1]):(j(n,-A,A,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)j(n[0],-A,-1,t),j(n[1],1,A,t),u=n[0],d=n[1];else if(j(n,-A,A,t),n)u=-(d=n<0?-n:n);else throw Error(O+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(O+`crypto unavailable`);else f=n;else throw Error(O+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],j(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],j(n,0,A,t),m=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)h=n;else throw Error(O+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(O+t+` invalid: `+n)}else throw Error(O+`Object expected: `+e);return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-A&&i<=A&&i===le(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%k,t<1&&(t+=k),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=de||n!==le(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(O+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return le(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:j(e,0,A),s=ce(e/k),f)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(O+`crypto unavailable`);if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=k,s&&e&&(c=pe[k-e],u[l]=le(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=k);for(l=1,c=u[0];c>=10;c/=10,l++);l<k&&(i-=k-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(xe(_e(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?xe(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=xe(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%me,u=t/me|0;for(e=e.slice();c--;)a=e[c]%me,o=e[c]/me|0,r=u*a+o*l,i=l*a+r%me*me+s,s=(i/n|0)+(r/me|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,ee,w,te,T=r.s==i.s?1:-1,E=r.c,D=i.c;if(!E||!E[0]||!D||!D[0])return new v(!r.s||!i.s||(E?D&&E[0]==D[0]:!D)?NaN:E&&E[0]==0||!D?T*0:T/0);for(h=new v(T),g=h.c=[],l=r.e-i.e,T=a+l+1,s||(s=de,l=ge(r.e/k)-ge(i.e/k),T=T/k|0),u=0;D[u]==(E[u]||0);u++);if(D[u]>(E[u]||0)&&l--,T<0)g.push(1),d=!0;else{for(C=E.length,w=D.length,u=0,T+=2,f=le(s/(D[0]+1)),f>1&&(D=e(D,f,s),E=e(E,f,s),w=D.length,C=E.length),x=w,_=E.slice(0,w),y=_.length;y<w;_[y++]=0);te=D.slice(),te=[0].concat(te),ee=D[0],D[1]>=s/2&&ee++;do{if(f=0,c=t(D,_,w,y),c<0){if(b=_[0],w!=y&&(b=b*s+(_[1]||0)),f=le(b/ee),f>1)for(f>=s&&(f=s-1),p=e(D,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,w<m?te:D,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=D.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(D,_,w,y)<1;)f++,n(_,w<y?te:D,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=E[x]||0:(_=[E[x]],y=1)}while((x++<C||_[0]!=null)&&T--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==de){for(u=1,T=g[0];T>=10;T/=10,u++);S(h,a+(h.e=u+l*k-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:j(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=_e(e.c),d=r==1||r==2&&(o<=c||o>=l)?be(d,o):xe(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=_e(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=be(d,a)}else if(t-=o+(r===2&&a>o),d=xe(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=ve(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*k-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(O+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=pe;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=k,o=t,c=p[l=0],f=le(c/m[i-o-1]%10);else if(l=ce((a+1)/k),l>=p.length)if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=k,o=a-k+1}else break out;else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=k,o=a-k+i,f=o<0?0:le(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(k-t%k)%k],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[k-a],p[l]=o>0?le(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==de&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=de)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=_e(e.c),t=n<=c||n>=l?be(t,n):xe(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return ve(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return j(e,0,A),t==null?t=s:j(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-ge(this.e/k))*k,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(O+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-ye(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&ye(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=ce(m/k+2));for(l?(n=new v(.5),u&&(e.s=1),d=ye(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=le(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=ye(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:j(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return ve(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return ve(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=ve(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&ge(this.e/k)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return ve(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=ve(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/k,u=e.e/k,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=ge(l),u=ge(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=de-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=de}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=ge(_.e/k)+ge(e.e/k),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=de,g=me,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/k,o=e.e/k,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=ge(a),o=ge(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/de|0,s[t]=de===s[t]?0:s[t]%de;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return j(e,1,A),t==null?t=s:j(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*k+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return j(e,-fe,fe),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=_e(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=ge((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),_e(a.c).slice(0,u)===(n=_e(r.c)).slice(0,u))if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(j(e,0,A),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(j(e,0,A),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(O+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(O+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=_e(y),c=n.e=g.length-_.e-1,n.c[0]=pe[(l=c%k)<0?k+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&j(e,1,A),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?be(_e(r.c),a):xe(_e(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=xe(_e(r.c),r.e,`0`)):(j(e,2,g.length,`Base`),t=n(xe(_e(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function ge(e){var t=e|0;return e>0||e===t?t:t-1}function _e(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=k-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function ve(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function j(e,t,n,r){if(e<t||e>n||e!==le(e))throw Error(O+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function ye(e){var t=e.c.length-1;return ge(e.e/k)==t&&e.c[t]%2!=0}function be(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function xe(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var M=he();function Se({id:e,name:t,address:n,currency:r,balance:i,spendableBalance:a,blockHeight:o,lastSyncDate:s,parentAccountId:c}){return{id:e,name:t,address:n,currency:r,balance:new M(i),spendableBalance:new M(a),blockHeight:o,lastSyncDate:new Date(s),parentAccountId:c}}var N;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(N||={});var Ce;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ce||={});var P=N.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),we=e=>{switch(typeof e){case`undefined`:return P.undefined;case`string`:return P.string;case`number`:return Number.isNaN(e)?P.nan:P.number;case`boolean`:return P.boolean;case`function`:return P.function;case`bigint`:return P.bigint;case`symbol`:return P.symbol;case`object`:return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?P.promise:typeof Map<`u`&&e instanceof Map?P.map:typeof Set<`u`&&e instanceof Set?P.set:typeof Date<`u`&&e instanceof Date?P.date:P.object;default:return P.unknown}},F=N.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Te=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Te.create=e=>new Te(e);var Ee=(e,t)=>{let n;switch(e.code){case F.invalid_type:n=e.received===P.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case F.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,N.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:n=`Unrecognized key(s) in object: ${N.joinValues(e.keys,`, `)}`;break;case F.invalid_union:n=`Invalid input`;break;case F.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${N.joinValues(e.options)}`;break;case F.invalid_enum_value:n=`Invalid enum value. Expected ${N.joinValues(e.options)}, received '${e.received}'`;break;case F.invalid_arguments:n=`Invalid function arguments`;break;case F.invalid_return_type:n=`Invalid function return type`;break;case F.invalid_date:n=`Invalid date`;break;case F.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:N.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case F.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case F.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case F.custom:n=`Invalid input`;break;case F.invalid_intersection_types:n=`Intersection results could not be merged`;break;case F.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case F.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,N.assertNever(e)}return{message:n}},De=Ee;function Oe(){return De}var ke=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function I(e,t){let n=Oe(),r=ke({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ee?void 0:Ee].filter(e=>!!e)});e.common.issues.push(r)}var Ae=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return L;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return L;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},L=Object.freeze({status:`aborted`}),je=e=>({status:`dirty`,value:e}),Me=e=>({status:`valid`,value:e}),Ne=e=>e.status===`aborted`,Pe=e=>e.status===`dirty`,Fe=e=>e.status===`valid`,Ie=e=>typeof Promise<`u`&&e instanceof Promise,R;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(R||={});var Le=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Re=(e,t)=>{if(Fe(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Te(e.common.issues);return this._error=t,this._error}}};function z(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var B=class{get description(){return this._def.description}_getType(e){return we(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ae,ctx:{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ie(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)};return Re(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Fe(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Fe(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)},r=this._parse({data:e,path:n.path,parent:n});return Re(n,await(Ie(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:F.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new Vt({schema:this,typeName:V.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Ht.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return St.create(this)}promise(){return Bt.create(this,this._def)}or(e){return Tt.create([this,e],this._def)}and(e){return kt.create(this,e,this._def)}transform(e){return new Vt({...z(this._def),schema:this,typeName:V.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Wt({...z(this._def),innerType:this,defaultValue:t,typeName:V.ZodDefault})}brand(){return new qt({typeName:V.ZodBranded,type:this,...z(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Gt({...z(this._def),innerType:this,catchValue:t,typeName:V.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Jt.create(this,e)}readonly(){return Yt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ze=/^c[^\s-]{8,}$/i,Be=/^[0-9a-z]+$/,Ve=/^[0-9A-HJKMNP-TV-Z]{26}$/i,He=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ue=/^[a-z0-9_-]{21}$/i,We=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ge=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ke=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Je,Ye=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ze=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tt=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,nt=RegExp(`^${tt}$`);function rt(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function it(e){return RegExp(`^${rt(e)}$`)}function at(e){let t=`${tt}T${rt(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ot(e,t){return!!((t===`v4`||!t)&&Ye.test(e)||(t===`v6`||!t)&&Ze.test(e))}function st(e,t){if(!We.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function ct(e,t){return!!((t===`v4`||!t)&&Xe.test(e)||(t===`v6`||!t)&&Qe.test(e))}var lt=class e extends B{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.string,received:t.parsedType}),L}let t=new Ae,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?I(n,{code:F.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&I(n,{code:F.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Ke.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`email`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Je||=new RegExp(qe,`u`),Je.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`emoji`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)He.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`uuid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Ue.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`nanoid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ze.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`cuid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Be.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`cuid2`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`ulid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),I(n,{validation:`url`,code:F.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`regex`,code:F.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?at(r).test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?nt.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?it(r).test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`duration`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?ot(e.data,r.version)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`ip`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?st(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`jwt`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?ct(e.data,r.version)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`cidr`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?$e.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`base64`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?et.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`base64url`,code:F.invalid_string,message:r.message}),t.dirty()):N.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:F.invalid_string,...R.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...R.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...R.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...R.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...R.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...R.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...R.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...R.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...R.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...R.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...R.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...R.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...R.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};lt.create=e=>new lt({checks:[],typeName:V.ZodString,coerce:e?.coerce??!1,...z(e)});function ut(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var dt=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==P.number){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.number,received:t.parsedType}),L}let t,n=new Ae;for(let r of this._def.checks)r.kind===`int`?N.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),I(t,{code:F.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?ut(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),I(t,{code:F.not_finite,message:r.message}),n.dirty()):N.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,R.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,R.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,R.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,R.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:R.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:R.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:R.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:R.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:R.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&N.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};dt.create=e=>new dt({checks:[],typeName:V.ZodNumber,coerce:e?.coerce||!1,...z(e)});var ft=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==P.bigint)return this._getInvalidInput(e);let t,n=new Ae;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):N.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit(`min`,e,!0,R.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,R.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,R.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,R.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:R.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:R.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ft.create=e=>new ft({checks:[],typeName:V.ZodBigInt,coerce:e?.coerce??!1,...z(e)});var pt=class extends B{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==P.boolean){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.boolean,received:t.parsedType}),L}return Me(e.data)}};pt.create=e=>new pt({typeName:V.ZodBoolean,coerce:e?.coerce||!1,...z(e)});var mt=class e extends B{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.date,received:t.parsedType}),L}if(Number.isNaN(e.data.getTime()))return I(this._getOrReturnCtx(e),{code:F.invalid_date}),L;let t=new Ae,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):N.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};mt.create=e=>new mt({checks:[],coerce:e?.coerce||!1,typeName:V.ZodDate,...z(e)});var ht=class extends B{_parse(e){if(this._getType(e)!==P.symbol){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.symbol,received:t.parsedType}),L}return Me(e.data)}};ht.create=e=>new ht({typeName:V.ZodSymbol,...z(e)});var gt=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.undefined,received:t.parsedType}),L}return Me(e.data)}};gt.create=e=>new gt({typeName:V.ZodUndefined,...z(e)});var _t=class extends B{_parse(e){if(this._getType(e)!==P.null){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.null,received:t.parsedType}),L}return Me(e.data)}};_t.create=e=>new _t({typeName:V.ZodNull,...z(e)});var vt=class extends B{constructor(){super(...arguments),this._any=!0}_parse(e){return Me(e.data)}};vt.create=e=>new vt({typeName:V.ZodAny,...z(e)});var yt=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Me(e.data)}};yt.create=e=>new yt({typeName:V.ZodUnknown,...z(e)});var bt=class extends B{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.never,received:t.parsedType}),L}};bt.create=e=>new bt({typeName:V.ZodNever,...z(e)});var xt=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.void,received:t.parsedType}),L}return Me(e.data)}};xt.create=e=>new xt({typeName:V.ZodVoid,...z(e)});var St=class e extends B{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==P.array)return I(t,{code:F.invalid_type,expected:P.array,received:t.parsedType}),L;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(I(t,{code:e?F.too_big:F.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(I(t,{code:F.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(I(t,{code:F.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Le(t,e,t.path,n)))).then(e=>Ae.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Le(t,e,t.path,n)));return Ae.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:R.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:R.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:R.toString(n)}})}nonempty(e){return this.min(1,e)}};St.create=(e,t)=>new St({type:e,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...z(t)});function Ct(e){if(e instanceof wt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ht.create(Ct(r))}return new wt({...e._def,shape:()=>t})}else if(e instanceof St)return new St({...e._def,type:Ct(e.element)});else if(e instanceof Ht)return Ht.create(Ct(e.unwrap()));else if(e instanceof Ut)return Ut.create(Ct(e.unwrap()));else if(e instanceof At)return At.create(e.items.map(e=>Ct(e)));else return e}var wt=class e extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=N.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==P.object){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.object,received:t.parsedType}),L}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof bt&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Le(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof bt){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(I(n,{code:F.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Le(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Ae.mergeObjectSync(t,e)):Ae.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return R.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:R.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:V.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of N.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of N.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Ct(this)}partial(t){let n={};for(let e of N.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of N.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ht;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Lt(N.objectKeys(this.shape))}};wt.create=(e,t)=>new wt({shape:()=>e,unknownKeys:`strip`,catchall:bt.create(),typeName:V.ZodObject,...z(t)}),wt.strictCreate=(e,t)=>new wt({shape:()=>e,unknownKeys:`strict`,catchall:bt.create(),typeName:V.ZodObject,...z(t)}),wt.lazycreate=(e,t)=>new wt({shape:e,unknownKeys:`strip`,catchall:bt.create(),typeName:V.ZodObject,...z(t)});var Tt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Te(e.ctx.common.issues));return I(t,{code:F.invalid_union,unionErrors:n}),L}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Te(e));return I(t,{code:F.invalid_union,unionErrors:i}),L}}get options(){return this._def.options}};Tt.create=(e,t)=>new Tt({options:e,typeName:V.ZodUnion,...z(t)});var Et=e=>e instanceof Ft?Et(e.schema):e instanceof Vt?Et(e.innerType()):e instanceof It?[e.value]:e instanceof Rt?e.options:e instanceof zt?N.objectValues(e.enum):e instanceof Wt?Et(e._def.innerType):e instanceof gt?[void 0]:e instanceof _t?[null]:e instanceof Ht?[void 0,...Et(e.unwrap())]:e instanceof Ut?[null,...Et(e.unwrap())]:e instanceof qt||e instanceof Yt?Et(e.unwrap()):e instanceof Gt?Et(e._def.innerType):[],Dt=class e extends B{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.object)return I(t,{code:F.invalid_type,expected:P.object,received:t.parsedType}),L;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(I(t,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Et(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:V.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...z(r)})}};function Ot(e,t){let n=we(e),r=we(t);if(e===t)return{valid:!0,data:e};if(n===P.object&&r===P.object){let n=N.objectKeys(t),r=N.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ot(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===P.array&&r===P.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ot(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===P.date&&r===P.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var kt=class extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Ne(e)||Ne(r))return L;let i=Ot(e.value,r.value);return i.valid?((Pe(e)||Pe(r))&&t.dirty(),{status:t.value,value:i.data}):(I(n,{code:F.invalid_intersection_types}),L)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};kt.create=(e,t,n)=>new kt({left:e,right:t,typeName:V.ZodIntersection,...z(n)});var At=class e extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.array)return I(n,{code:F.invalid_type,expected:P.array,received:n.parsedType}),L;if(n.data.length<this._def.items.length)return I(n,{code:F.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),L;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Le(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Ae.mergeArray(t,e)):Ae.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};At.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new At({items:e,typeName:V.ZodTuple,rest:null,...z(t)})};var jt=class e extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.object)return I(n,{code:F.invalid_type,expected:P.object,received:n.parsedType}),L;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Le(n,e,n.path,e)),value:a._parse(new Le(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ae.mergeObjectAsync(t,r):Ae.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof B?new e({keyType:t,valueType:n,typeName:V.ZodRecord,...z(r)}):new e({keyType:lt.create(),valueType:t,typeName:V.ZodRecord,...z(n)})}},Mt=class extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.map)return I(n,{code:F.invalid_type,expected:P.map,received:n.parsedType}),L;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Le(n,e,n.path,[a,`key`])),value:i._parse(new Le(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return L;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return L;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Mt.create=(e,t,n)=>new Mt({valueType:t,keyType:e,typeName:V.ZodMap,...z(n)});var Nt=class e extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.set)return I(n,{code:F.invalid_type,expected:P.set,received:n.parsedType}),L;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(I(n,{code:F.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(I(n,{code:F.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return L;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Le(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:R.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:R.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Nt.create=(e,t)=>new Nt({valueType:e,minSize:null,maxSize:null,typeName:V.ZodSet,...z(t)});var Pt=class e extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.function)return I(t,{code:F.invalid_type,expected:P.function,received:t.parsedType}),L;function n(e,n){return ke({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oe(),Ee].filter(e=>!!e),issueData:{code:F.invalid_arguments,argumentsError:n}})}function r(e,n){return ke({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oe(),Ee].filter(e=>!!e),issueData:{code:F.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Bt){let e=this;return Me(async function(...t){let o=new Te([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return Me(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Te([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Te([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:At.create(t).rest(yt.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||At.create([]).rest(yt.create()),returns:n||yt.create(),typeName:V.ZodFunction,...z(r)})}},Ft=class extends B{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ft.create=(e,t)=>new Ft({getter:e,typeName:V.ZodLazy,...z(t)});var It=class extends B{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:F.invalid_literal,expected:this._def.value}),L}return{status:`valid`,value:e.data}}get value(){return this._def.value}};It.create=(e,t)=>new It({value:e,typeName:V.ZodLiteral,...z(t)});function Lt(e,t){return new Rt({values:e,typeName:V.ZodEnum,...z(t)})}var Rt=class e extends B{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return I(t,{expected:N.joinValues(n),received:t.parsedType,code:F.invalid_type}),L}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return I(t,{received:t.data,code:F.invalid_enum_value,options:n}),L}return Me(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Rt.create=Lt;var zt=class extends B{_parse(e){let t=N.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==P.string&&n.parsedType!==P.number){let e=N.objectValues(t);return I(n,{expected:N.joinValues(e),received:n.parsedType,code:F.invalid_type}),L}if(this._cache||=new Set(N.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=N.objectValues(t);return I(n,{received:n.data,code:F.invalid_enum_value,options:e}),L}return Me(e.data)}get enum(){return this._def.values}};zt.create=(e,t)=>new zt({values:e,typeName:V.ZodNativeEnum,...z(t)});var Bt=class extends B{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==P.promise&&t.common.async===!1?(I(t,{code:F.invalid_type,expected:P.promise,received:t.parsedType}),L):Me((t.parsedType===P.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Bt.create=(e,t)=>new Bt({type:e,typeName:V.ZodPromise,...z(t)});var Vt=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{I(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return L;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?L:r.status===`dirty`||t.value===`dirty`?je(r.value):r});{if(t.value===`aborted`)return L;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?L:r.status===`dirty`||t.value===`dirty`?je(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?L:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?L:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Fe(e))return L;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Fe(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):L);N.assertNever(r)}};Vt.create=(e,t,n)=>new Vt({schema:e,typeName:V.ZodEffects,effect:t,...z(n)}),Vt.createWithPreprocess=(e,t,n)=>new Vt({schema:t,effect:{type:`preprocess`,transform:e},typeName:V.ZodEffects,...z(n)});var Ht=class extends B{_parse(e){return this._getType(e)===P.undefined?Me(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ht.create=(e,t)=>new Ht({innerType:e,typeName:V.ZodOptional,...z(t)});var Ut=class extends B{_parse(e){return this._getType(e)===P.null?Me(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ut.create=(e,t)=>new Ut({innerType:e,typeName:V.ZodNullable,...z(t)});var Wt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Wt.create=(e,t)=>new Wt({innerType:e,typeName:V.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...z(t)});var Gt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ie(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:V.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...z(t)});var Kt=class extends B{_parse(e){if(this._getType(e)!==P.nan){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.nan,received:t.parsedType}),L}return{status:`valid`,value:e.data}}};Kt.create=e=>new Kt({typeName:V.ZodNaN,...z(e)});var qt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Jt=class e extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?L:e.status===`dirty`?(t.dirty(),je(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?L:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:V.ZodPipeline})}},Yt=class extends B{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Fe(e)&&(e.value=Object.freeze(e.value)),e);return Ie(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Yt.create=(e,t)=>new Yt({innerType:e,typeName:V.ZodReadonly,...z(t)}),wt.lazycreate;var V;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(V||={});var H=lt.create,U=dt.create;Kt.create,ft.create;var Xt=pt.create;mt.create,ht.create;var Zt=gt.create,W=_t.create,Qt=vt.create,$t=yt.create;bt.create;var en=xt.create,G=St.create,K=wt.create;wt.strictCreate;var q=Tt.create,tn=Dt.create;kt.create,At.create;var nn=jt.create;Mt.create,Nt.create,Pt.create,Ft.create;var J=It.create,Y=Rt.create;zt.create,Bt.create,Vt.create;var rn=Ht.create;Ut.create,Vt.createWithPreprocess,Jt.create;var an=K({id:H(),name:H(),address:H(),currency:H(),balance:H(),spendableBalance:H(),blockHeight:q([U(),Zt()]),lastSyncDate:H(),parentAccountId:H().optional()}),on=Y([`CryptoCurrency`,`TokenCurrency`]),sn=Y([`ERC20`]),cn=K({color:H(),ticker:H(),id:H(),name:H(),decimals:U()}),ln=tn(`type`,[cn.extend({type:J(on.enum.CryptoCurrency),family:H()}),cn.extend({type:J(on.enum.TokenCurrency),parent:H()}).extend({standard:sn,contract:H()})]),X=K({amount:H(),recipient:H()}),Z=Y(`algorand.aptos.bitcoin.cardano.casper.celo.crypto_org.cosmos.elrond.ethereum.filecoin.hedera.internet_computer.kaspa.near.neo.polkadot.ripple.solana.stacks.stellar.sui.tezos.ton.tron.vechain`.split(`.`)),un=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:a.toString(),recipient:o,fees:n?n.toString():void 0,memo:i,mode:t,assetId:r}),dn=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:new M(a),recipient:o,fees:n?new M(n):void 0,memo:i,mode:t,assetId:r}),fn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),pn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new M(r),recipient:i,fees:n?new M(n):void 0,mode:t});u();function mn({family:e,amount:t,recipient:n,feePerByte:r,opReturnData:i,changeAddress:a}){return{family:e,amount:t.toString(),recipient:n,feePerByte:r?.toString(),opReturnDataHex:i?.toString(`hex`),changeAddress:a}}function hn({family:e,amount:t,recipient:n,feePerByte:r,opReturnDataHex:i,changeAddress:a}){return{family:e,amount:new M(t),recipient:n,feePerByte:r?new M(r):void 0,opReturnData:i?d.from(i,`hex`):void 0,changeAddress:a}}function gn({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,index:r,mode:i,recipient:a}}function _n({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:new M(e),family:t,fees:n?new M(n):void 0,index:r,mode:i,recipient:a}}var vn=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gas:a?a.toString():void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:e.amount.toString()})):void 0}),yn=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0,gas:a?new M(a):void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:new M(e.amount)})):void 0}),bn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),xn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new M(r),recipient:i,fees:n?new M(n):void 0,mode:t});u();function Sn({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:t.toString(),recipient:n,nonce:r,data:i?i.toString(`hex`):void 0,gasPrice:a?a.toString():void 0,gasLimit:o?o.toString():void 0,maxPriorityFeePerGas:s?s.toString():void 0,maxFeePerGas:c?c.toString():void 0,sponsored:l}}function Cn({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:new M(t),recipient:n,nonce:r,data:i?d.from(i,`hex`):void 0,gasPrice:a?new M(a):void 0,gasLimit:o?new M(o):void 0,maxPriorityFeePerGas:s?new M(s):void 0,maxFeePerGas:c?new M(c):void 0,sponsored:l}}function wn({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function Tn({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0}}function En({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:e.toString(),family:t,memo:n,recipient:r}}function Dn({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:new M(e),family:t,memo:n,recipient:r}}function On({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:t.toString(),recipient:n,customFeeRate:r?.toString()}}function kn({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:new M(t),recipient:n,customFeeRate:r?new M(r):void 0}}u();function An({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:e.toString(),data:t?t.toString(`hex`):void 0,family:n,gasLimit:o.toNumber(),gasFeeCap:s.toString(),gasPremium:c.toString(),method:r,nonce:i,params:a,recipient:l,version:u}}function jn({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:new M(e),data:t?d.from(t,`hex`):void 0,family:n,gasLimit:new M(o),gasFeeCap:new M(s),gasPremium:new M(c),nonce:i,method:r,params:a,recipient:l,version:u}}function Mn({amount:e,recipient:t,family:n}){return{amount:e.toString(),recipient:t,family:n}}function Nn({amount:e,recipient:t,family:n}){return{amount:new M(e),recipient:t,family:n}}var Pn=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fee:i?i.toString():void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),Fn=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:new M(e),recipient:t,family:n,mode:r,fee:i?new M(i):void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),In=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fee:t?t.toString():void 0,tag:n}),Ln=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:new M(r),recipient:i,fee:t?new M(t):void 0,tag:n}),Rn=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:e.toString(),recipient:t,family:n,fees:r?r.toString():void 0,memoType:i,memoValue:a}),zn=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:new M(e),recipient:t,family:n,fees:r?new M(r):void 0,memoType:i,memoValue:a}),Bn=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gasLimit:a?a.toString():void 0}),Vn=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0,gasLimit:a?new M(a):void 0}),Hn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.inspectSymbol=void 0,e.inspectSymbol=Symbol.for(`nodejs.util.inspect.custom`)})),Un=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.crc16=void 0;function t(e){let t=0,n=d.alloc(e.length+2);n.set(e);for(let e of n){let n=128;for(;n>0;)t<<=1,e&n&&(t+=1),n>>=1,t>65535&&(t&=65535,t^=4129)}return d.from([Math.floor(t/256),t%256])}e.crc16=t})),Wn=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.address=e.Address=void 0;var n=Hn(),r=Un(),i=17,a=81,o=128;function s(e){if(typeof e==`string`&&!c.isFriendly(e))throw Error(`Unknown address type`);let t=d.isBuffer(e)?e:d.from(e,`base64`);if(t.length!==36)throw Error(`Unknown address type: byte length is not equal to 36`);let n=t.subarray(0,34),s=t.subarray(34,36),l=(0,r.crc16)(n);if(!(l[0]===s[0]&&l[1]===s[1]))throw Error(`Invalid checksum: `+e);let u=n[0],f=!1,p=!1;if(u&o&&(f=!0,u^=o),u!==i&&u!==a)throw`Unknown address tag`;p=u===i;let m=null;m=n[1]===255?-1:n[1];let h=n.subarray(2,34);return{isTestOnly:f,isBounceable:p,workchain:m,hashPart:h}}var c=class e{static isAddress(t){return t instanceof e}static isFriendly(e){return!(e.length!==48||!/^[A-Za-z0-9+/_-]+$/.test(e))}static isRaw(e){if(e.indexOf(`:`)===-1)return!1;let[t,n]=e.split(`:`);return!(!Number.isInteger(parseFloat(t))||!/[a-f0-9]+/.test(n.toLowerCase())||n.length!==64)}static normalize(t){return typeof t==`string`?e.parse(t).toString():t.toString()}static parse(t){if(e.isFriendly(t))return this.parseFriendly(t).address;if(e.isRaw(t))return this.parseRaw(t);throw Error(`Unknown address type: `+t)}static parseRaw(t){return new e(parseInt(t.split(`:`)[0]),d.from(t.split(`:`)[1],`hex`))}static parseFriendly(t){if(d.isBuffer(t)){let n=s(t);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}else{let n=s(t.replace(/\-/g,`+`).replace(/_/g,`/`));return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}}constructor(e,n){if(this.toRawString=()=>this.workChain+`:`+this.hash.toString(`hex`),this.toRaw=()=>{let e=d.alloc(36);return e.set(this.hash),e.set([this.workChain,this.workChain,this.workChain,this.workChain],32),e},this.toStringBuffer=e=>{let t=e&&e.testOnly!==void 0?e.testOnly:!1,n=!(e&&e.bounceable!==void 0)||e.bounceable?i:a;t&&(n|=o);let s=d.alloc(34);s[0]=n,s[1]=this.workChain,s.set(this.hash,2);let c=d.alloc(36);return c.set(s),c.set((0,r.crc16)(s),34),c},this.toString=e=>{let t=e&&e.urlSafe!==void 0?e.urlSafe:!0,n=this.toStringBuffer(e);return t?n.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`):n.toString(`base64`)},this[t]=()=>this.toString(),n.length!==32)throw Error(`Invalid address hash length: `+n.length);this.workChain=e,this.hash=n,Object.freeze(this)}equals(e){return e.workChain===this.workChain?e.hash.equals(this.hash):!1}};e.Address=c,t=n.inspectSymbol;function l(e){return c.parse(e)}e.address=l})),Gn=e((e=>{var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.ExternalAddress=void 0;var n=Hn();e.ExternalAddress=class e{static isAddress(t){return t instanceof e}constructor(e,n){this[t]=()=>this.toString(),this.value=e,this.bits=n}toString(){return`External<${this.bits}:${this.value}>`}},t=n.inspectSymbol})),Kn=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.base32Decode=e.base32Encode=void 0;var t=`abcdefghijklmnopqrstuvwxyz234567`;function n(e){let n=e.byteLength,r=0,i=0,a=``;for(let o=0;o<n;o++)for(i=i<<8|e[o],r+=8;r>=5;)a+=t[i>>>r-5&31],r-=5;return r>0&&(a+=t[i<<5-r&31]),a}e.base32Encode=n;function r(e,t){let n=e.indexOf(t);if(n===-1)throw Error(`Invalid character found: `+t);return n}function i(e){let n;n=e.toLowerCase();let{length:i}=n,a=0,o=0,s=0,c=d.alloc(i*5/8|0);for(let e=0;e<i;e++)o=o<<5|r(t,n[e]),a+=5,a>=8&&(c[s++]=o>>>a-8&255,a-=8);return c}e.base32Decode=i})),qn=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.ADNLAddress=void 0;var n=Hn(),r=Kn(),i=Un();e.ADNLAddress=class e{static parseFriendly(t){if(t.length!==55)throw Error(`Invalid address`);t=`f`+t;let n=(0,r.base32Decode)(t);if(n[0]!==45)throw Error(`Invalid address`);let a=n.slice(33);if(!(0,i.crc16)(n.slice(0,33)).equals(a))throw Error(`Invalid address`);return new e(n.slice(1,33))}static parseRaw(t){return new e(d.from(t,`base64`))}constructor(e){if(this.toRaw=()=>this.address.toString(`hex`).toUpperCase(),this.toString=()=>{let e=d.concat([d.from([45]),this.address]),t=(0,i.crc16)(e);return e=d.concat([e,t]),(0,r.base32Encode)(e).slice(1)},this[t]=()=>this.toString(),e.length!==32)throw Error(`Invalid address`);this.address=e}equals(e){return this.address.equals(e.address)}},t=n.inspectSymbol})),Jn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.paddedBufferToBits=e.bitsToPaddedBuffer=void 0;var t=Xn(),n=Yn();function r(e){let n=new t.BitBuilder(Math.ceil(e.length/8)*8);n.writeBits(e);let r=Math.ceil(e.length/8)*8-e.length;for(let e=0;e<r;e++)e===0?n.writeBit(1):n.writeBit(0);return n.buffer()}e.bitsToPaddedBuffer=r;function i(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n]!==0){let r=e[n],i=r&-r;i&1||(i=Math.log2(i)+1),n>0&&(t=n<<3),t+=8-i;break}return new n.BitString(e,0,t)}e.paddedBufferToBits=i})),Yn=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.BitString=void 0;var n=Jn(),r=Hn(),i=class e{static isBitString(t){return t instanceof e}constructor(e,n,r){if(this[t]=()=>this.toString(),r<0)throw Error(`Length ${r} is out of bounds`);this._length=r,this._data=e,this._offset=n}get length(){return this._length}at(e){if(e>=this._length)throw Error(`Index ${e} > ${this._length} is out of bounds`);if(e<0)throw Error(`Index ${e} < 0 is out of bounds`);let t=this._offset+e>>3,n=7-(this._offset+e)%8;return(this._data[t]&1<<n)!=0}substring(t,n){if(t>this._length)throw Error(`Offset(${t}) > ${this._length} is out of bounds`);if(t<0)throw Error(`Offset(${t}) < 0 is out of bounds`);if(n===0)return e.EMPTY;if(t+n>this._length)throw Error(`Offset ${t} + Length ${n} > ${this._length} is out of bounds`);return new e(this._data,this._offset+t,n)}subbuffer(e,t){if(e>this._length||e<0)throw Error(`Offset ${e} is out of bounds`);if(e+t>this._length)throw Error(`Offset + Length = ${e+t} is out of bounds`);if(t%8!=0||(this._offset+e)%8!=0)return null;let n=this._offset+e>>3,r=n+(t>>3);return this._data.subarray(n,r)}equals(e){if(this._length!==e._length)return!1;for(let t=0;t<this._length;t++)if(this.at(t)!==e.at(t))return!1;return!0}toString(){let e=(0,n.bitsToPaddedBuffer)(this);if(this._length%4==0){let t=e.subarray(0,Math.ceil(this._length/8)).toString(`hex`).toUpperCase();return this._length%8==0?t:t.substring(0,t.length-1)}else{let t=e.toString(`hex`).toUpperCase();return this._length%8<=4?t.substring(0,t.length-1)+`_`:t+`_`}}};e.BitString=i,t=r.inspectSymbol,i.EMPTY=new i(d.alloc(0),0,0)})),Xn=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.BitBuilder=void 0;var t=Wn(),n=Gn(),r=Yn();e.BitBuilder=class{constructor(e=1023){this._buffer=d.alloc(Math.ceil(e/8)),this._length=0}get length(){return this._length}writeBit(e){let t=this._length;if(t>this._buffer.length*8)throw Error(`BitBuilder overflow`);(typeof e==`boolean`&&e===!0||typeof e==`number`&&e>0)&&(this._buffer[t/8|0]|=1<<7-t%8),this._length++}writeBits(e){for(let t=0;t<e.length;t++)this.writeBit(e.at(t))}writeBuffer(e){if(this._length%8==0){if(this._length+e.length*8>this._buffer.length*8)throw Error(`BitBuilder overflow`);e.copy(this._buffer,this._length/8),this._length+=e.length*8}else for(let t=0;t<e.length;t++)this.writeUint(e[t],8)}writeUint(e,t){if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);let n=BigInt(e);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}let r=1n<<BigInt(t);if(n<0||n>=r)throw Error(`bitLength is too small for a value ${e}. Got ${t}`);if(this._length+t>this._buffer.length*8)throw Error(`BitBuilder overflow`);let i=8-this._length%8;if(i>0){let e=Math.floor(this._length/8);if(t<i){let r=Number(n);this._buffer[e]|=r<<i-t,this._length+=t}else{let r=Number(n>>BigInt(t-i));this._buffer[e]|=r,this._length+=i}}for(t-=i;t>0;)t>=8?(this._buffer[this._length/8]=Number(n>>BigInt(t-8)&255n),this._length+=8,t-=8):(this._buffer[this._length/8]=Number(n<<BigInt(8-t)&255n),this._length+=t,t=0)}writeInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}if(t===1){if(n!==-1n&&n!==0n)throw Error(`value is not zero or -1 for ${t} bits. Got ${e}`);this.writeBit(n===-1n);return}let r=1n<<BigInt(t)-1n;if(n<-r||n>=r)throw Error(`value is out of range for ${t} bits. Got ${e}`);n<0?(this.writeBit(!0),n=r+n):this.writeBit(!1),this.writeUint(n,t-1)}writeVarUint(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n<0)throw Error(`value is negative. Got ${e}`);if(n===0n){this.writeUint(0,t);return}let r=Math.ceil(n.toString(2).length/8),i=r*8;this.writeUint(r,t),this.writeUint(n,i)}writeVarInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n===0n){this.writeUint(0,t);return}let r=n>0?n:-n,i=Math.ceil((r.toString(2).length+1)/8),a=i*8;this.writeUint(i,t),this.writeInt(n,a)}writeCoins(e){this.writeVarUint(e,4)}writeAddress(e){if(e==null){this.writeUint(0,2);return}if(t.Address.isAddress(e)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(e.workChain,8),this.writeBuffer(e.hash);return}if(n.ExternalAddress.isAddress(e)){this.writeUint(1,2),this.writeUint(e.bits,9),this.writeUint(e.value,e.bits);return}throw Error(`Invalid address. Got ${e}`)}build(){return new r.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!=0)throw Error(`BitBuilder buffer is not byte aligned`);return this._buffer.subarray(0,this._length/8)}}})),Zn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CellType=void 0;var t;(function(e){e[e.Ordinary=-1]=`Ordinary`,e[e.PrunedBranch=1]=`PrunedBranch`,e[e.Library=2]=`Library`,e[e.MerkleProof=3]=`MerkleProof`,e[e.MerkleUpdate=4]=`MerkleUpdate`})(t||(e.CellType=t={}))})),Qn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readUnaryLength=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}e.readUnaryLength=t})),$n=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.BitReader=void 0;var t=Wn(),n=Gn();e.BitReader=class e{constructor(e,t=0){this._checkpoints=[],this._bits=e,this._offset=t}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(e){if(e<0||this._offset+e>this._bits.length)throw Error(`Index ${this._offset+e} is out of bounds`);this._offset+=e}reset(){this._checkpoints.length>0?this._offset=this._checkpoints.pop():this._offset=0}save(){this._checkpoints.push(this._offset)}loadBit(){let e=this._bits.at(this._offset);return this._offset++,e}preloadBit(){return this._bits.at(this._offset)}loadBits(e){let t=this._bits.substring(this._offset,e);return this._offset+=e,t}preloadBits(e){return this._bits.substring(this._offset,e)}loadBuffer(e){let t=this._preloadBuffer(e,this._offset);return this._offset+=e*8,t}preloadBuffer(e){return this._preloadBuffer(e,this._offset)}loadUint(e){return this._toSafeInteger(this.loadUintBig(e),`loadUintBig`)}loadUintBig(e){let t=this.preloadUintBig(e);return this._offset+=e,t}preloadUint(e){return this._toSafeInteger(this._preloadUint(e,this._offset),`preloadUintBig`)}preloadUintBig(e){return this._preloadUint(e,this._offset)}loadInt(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,this._toSafeInteger(t,`loadUintBig`)}loadIntBig(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,t}preloadInt(e){return this._toSafeInteger(this._preloadInt(e,this._offset),`preloadIntBig`)}preloadIntBig(e){return this._preloadInt(e,this._offset)}loadVarUint(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadUintBig(t*8),`loadVarUintBig`)}loadVarUintBig(e){let t=Number(this.loadUint(e));return this.loadUintBig(t*8)}preloadVarUint(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadUint(t*8,this._offset+e),`preloadVarUintBig`)}preloadVarUintBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadUint(t*8,this._offset+e)}loadVarInt(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadIntBig(t*8),`loadVarIntBig`)}loadVarIntBig(e){let t=Number(this.loadUint(e));return this.loadIntBig(t*8)}preloadVarInt(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadInt(t*8,this._offset+e),`preloadVarIntBig`)}preloadVarIntBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadInt(t*8,this._offset+e)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===2)return this._loadInternalAddress();throw Error(`Invalid address: `+e)}loadMaybeAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();throw Error(`Invalid address`)}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadMaybeExternalAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadAddressAny(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();if(e===1)return this._loadExternalAddress();throw Error(e===3?`Unsupported`:`Unreachable`)}loadPaddedBits(e){if(e%8!=0)throw Error(`Invalid number of bits`);let t=e;for(;;)if(this._bits.at(this._offset+t-1)){t--;break}else t--;let n=this._bits.substring(this._offset,t);return this._offset+=e,n}clone(){return new e(this._bits,this._offset)}_preloadInt(e,t){if(e==0)return 0n;let n=this._bits.at(t),r=0n;for(let n=0;n<e-1;n++)this._bits.at(t+1+n)&&(r+=1n<<BigInt(e-n-1-1));return n&&(r-=1n<<BigInt(e-1)),r}_preloadUint(e,t){if(e==0)return 0n;let n=0n;for(let r=0;r<e;r++)this._bits.at(t+r)&&(n+=1n<<BigInt(e-r-1));return n}_preloadBuffer(e,t){let n=this._bits.subbuffer(t,e*8);if(n)return n;let r=d.alloc(e);for(let n=0;n<e;n++)r[n]=Number(this._preloadUint(8,t+n*8));return r}_loadInternalAddress(){if(Number(this._preloadUint(2,this._offset))!==2)throw Error(`Invalid address`);let e,n;this._preloadUint(1,this._offset+2)!==0n&&(n=Number(this._preloadUint(5,this._offset+3)),e=this._preloadUint(n,this._offset+8),this._offset+=5+n);let r=Number(this._preloadInt(8,this._offset+3)),i=this._preloadBuffer(32,this._offset+11);if(n!==void 0&&e!==void 0){let t=Number(e),r=0,a=0,o=n;for(;o>0;){let e=Math.min(8-a,o),n=(1<<e)-1<<8-a-e,s=(t>>o-e&(1<<e)-1)<<8-a-e;i[r]=i[r]&~n|s,o-=e,a+=e,a===8&&(r++,a=0)}}return this._offset+=267,new t.Address(r,i)}_loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))!==1)throw Error(`Invalid address`);let e=Number(this._preloadUint(9,this._offset+2)),t=this._preloadUint(e,this._offset+11);return this._offset+=11+e,new n.ExternalAddress(t,e)}_toSafeInteger(e,t){if(BigInt(2**53-1)<e||e<BigInt(-(2**53-1)))throw TypeError(`${e} is out of safe integer range. Use ${t} instead`);return Number(e)}}})),er=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertToMerkleProof=e.exoticMerkleProof=void 0;var t=$n(),n=Q();function r(e,n){let r=new t.BitReader(e);if(e.length!==280)throw Error(`Merkle Proof cell must have exactly (8 + 256 + 16) bits, got "${e.length}"`);if(n.length!==1)throw Error(`Merkle Proof cell must have exactly 1 ref, got "${n.length}"`);let i=r.loadUint(8);if(i!==3)throw Error(`Merkle Proof cell must have type 3, got "${i}"`);let a=r.loadBuffer(32),o=r.loadUint(16),s=n[0].hash(0),c=n[0].depth(0);if(o!==c)throw Error(`Merkle Proof cell ref depth must be exactly "${o}", got "${c}"`);if(!a.equals(s))throw Error(`Merkle Proof cell ref hash must be exactly "${a.toString(`hex`)}", got "${s.toString(`hex`)}"`);return{proofDepth:o,proofHash:a}}e.exoticMerkleProof=r;function i(e){return(0,n.beginCell)().storeUint(3,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).storeRef(e).endCell({exotic:!0})}e.convertToMerkleProof=i})),tr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.generateMerkleProof=e.generateMerkleProofDirect=void 0;var t=Q(),n=Qn(),r=er();function i(e){return(0,t.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).endCell({exotic:!0})}function a(e,r,o,s){let c=r.asCell();if(s.length==0)return i(c);let l=+!!r.loadBit(),u=0,d=e;if(l===0){u=(0,n.readUnaryLength)(r);for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let t=0;t<u;t++)d+=e}if(o-u===0)return c;{let e=c.beginParse(),n=e.loadRef(),r=e.loadRef();if(!n.isExotic){let e=s.filter(e=>d+`0`===e.slice(0,d.length+1));n=a(d+`0`,n.beginParse(),o-u-1,e)}if(!r.isExotic){let e=s.filter(e=>d+`1`===e.slice(0,d.length+1));r=a(d+`1`,r.beginParse(),o-u-1,e)}return(0,t.beginCell)().storeSlice(e).storeRef(n).storeRef(r).endCell()}}function o(e,n,r){return n.forEach(t=>{if(!e.has(t))throw Error(`Trying to generate merkle proof for a missing key "${t}"`)}),a(``,(0,t.beginCell)().storeDictDirect(e).asSlice(),r.bits,n.map(e=>r.serialize(e).toString(2).padStart(r.bits,`0`)))}e.generateMerkleProofDirect=o;function s(e,t,n){return(0,r.convertToMerkleProof)(o(e,t,n))}e.generateMerkleProof=s})),nr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.generateMerkleUpdate=void 0;var t=Q(),n=tr();function r(e,n){return(0,t.beginCell)().storeUint(4,8).storeBuffer(e.hash(0)).storeBuffer(n.hash(0)).storeUint(e.depth(0),16).storeUint(n.depth(0),16).storeRef(e).storeRef(n).endCell({exotic:!0})}function i(e,t,i,a){let o=(0,n.generateMerkleProof)(e,[t],i).refs[0];e.set(t,a);let s=(0,n.generateMerkleProof)(e,[t],i).refs[0];return r(o,s)}e.generateMerkleUpdate=i})),rr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseDict=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}function n(e,r,i,a,o){let s=+!!r.loadBit(),c=0,l=e;if(s===0){c=t(r);for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let t=0;t<c;t++)l+=e}if(i-c===0)a.set(BigInt(`0b`+l),o(r));else{let e=r.loadRef(),t=r.loadRef();e.isExotic||n(l+`0`,e.beginParse(),i-c-1,a,o),t.isExotic||n(l+`1`,t.beginParse(),i-c-1,a,o)}}function r(e,t,r){let i=new Map;return e&&n(``,e,t,i,r),i}e.parseDict=r})),ir=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.findCommonPrefix=void 0;function t(e,t=0){if(e.length===0)return``;let n=e[0].slice(t);for(let r=1;r<e.length;r++){let i=e[r];for(;i.indexOf(n,t)!==t;)if(n=n.substring(0,n.length-1),n===``)return n}return n}e.findCommonPrefix=t})),ar=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serializeDict=e.detectLabelType=e.writeLabelSame=e.writeLabelLong=e.writeLabelShort=e.buildTree=void 0;var t=Q(),n=ir();function r(e,t){for(;e.length<t;)e=`0`+e;return e}function i(e,t){if(e.size===0)throw Error(`Internal inconsistency`);let n=new Map,r=new Map;for(let[i,a]of e.entries())i[t]===`0`?n.set(i,a):r.set(i,a);if(n.size===0)throw Error(`Internal inconsistency. Left emtpy.`);if(r.size===0)throw Error(`Internal inconsistency. Right emtpy.`);return{left:n,right:r}}function a(e,t){if(e.size===0)throw Error(`Internal inconsistency`);if(e.size===1)return{type:`leaf`,value:Array.from(e.values())[0]};let{left:n,right:r}=i(e,t);return{type:`fork`,left:o(n,t+1),right:o(r,t+1)}}function o(e,t=0){if(e.size===0)throw Error(`Internal inconsistency`);let r=(0,n.findCommonPrefix)(Array.from(e.keys()),t);return{label:r,node:a(e,r.length+t)}}function s(e,t){let n=new Map;for(let i of Array.from(e.keys())){let a=r(i.toString(2),t);n.set(a,e.get(i))}return o(n)}e.buildTree=s;function c(e,t){t.storeBit(0);for(let n=0;n<e.length;n++)t.storeBit(1);return t.storeBit(0),e.length>0&&t.storeUint(BigInt(`0b`+e),e.length),t}e.writeLabelShort=c;function l(e){return 1+e.length+1+e.length}function u(e,t,n){n.storeBit(1),n.storeBit(0);let r=Math.ceil(Math.log2(t+1));return n.storeUint(e.length,r),e.length>0&&n.storeUint(BigInt(`0b`+e),e.length),n}e.writeLabelLong=u;function d(e,t){return 2+Math.ceil(Math.log2(t+1))+e.length}function f(e,t,n,r){r.storeBit(1),r.storeBit(1),r.storeBit(e);let i=Math.ceil(Math.log2(n+1));r.storeUint(t,i)}e.writeLabelSame=f;function p(e){return 3+Math.ceil(Math.log2(e+1))}function m(e){if(e.length===0||e.length===1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}function h(e,t){let n=`short`,r=l(e),i=d(e,t);if(i<r&&(r=i,n=`long`),m(e)){let e=p(t);e<r&&(r=e,n=`same`)}return n}e.detectLabelType=h;function g(e,t,n){let r=h(e,t);r===`short`?c(e,n):r===`long`?u(e,t,n):r===`same`&&f(e[0]===`1`,e.length,t,n)}function _(e,n,r,i){if(e.type===`leaf`&&r(e.value,i),e.type===`fork`){let a=(0,t.beginCell)(),o=(0,t.beginCell)();v(e.left,n-1,r,a),v(e.right,n-1,r,o),i.storeRef(a),i.storeRef(o)}}function v(e,t,n,r){g(e.label,t,r),_(e.node,t-e.label.length,n,r)}function y(e,t,n,r){v(s(e,t),t,n,r)}e.serializeDict=y})),or=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.deserializeInternalKey=e.serializeInternalKey=void 0;var t=Wn(),n=Yn(),r=Jn();function i(e){if(typeof e==`number`){if(!Number.isSafeInteger(e))throw Error(`Invalid key type: not a safe integer: `+e);return`n:`+e.toString(10)}else if(typeof e==`bigint`)return`b:`+e.toString(10);else if(t.Address.isAddress(e))return`a:`+e.toString();else if(d.isBuffer(e))return`f:`+e.toString(`hex`);else if(n.BitString.isBitString(e))return`B:`+e.toString();else throw Error(`Invalid key type`)}e.serializeInternalKey=i;function a(e){let i=e.slice(0,2),a=e.slice(2);if(i===`n:`)return parseInt(a,10);if(i===`b:`)return BigInt(a);if(i===`a:`)return t.Address.parse(a);if(i===`f:`)return d.from(a,`hex`);if(i===`B:`){let e=a.slice(-1)==`_`;if(e||a.length%2!=0){let t=e?a.length-1:a.length,i=a.substr(0,t)+`0`;return!e&&t&1?new n.BitString(d.from(i,`hex`),0,t<<2):(0,r.paddedBufferToBits)(d.from(i,`hex`))}else return new n.BitString(d.from(a,`hex`),0,a.length<<2)}throw Error(`Invalid key type: `+i)}e.deserializeInternalKey=a})),sr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.Dictionary=void 0;var t=Wn(),n=Q(),r=xr(),i=Yn(),a=tr(),o=nr(),s=rr(),c=ar(),l=or(),f=class e{static empty(t,n){return t&&n?new e(new Map,t,n):new e(new Map,null,null)}static load(t,n,i){let a;if(i instanceof r.Cell){if(i.isExotic)return e.empty(t,n);a=i.beginParse()}else a=i;let o=a.loadMaybeRef();return o&&!o.isExotic?e.loadDirect(t,n,o.beginParse()):e.empty(t,n)}static loadDirect(t,n,i){if(!i)return e.empty(t,n);let a;a=i instanceof r.Cell?i.beginParse():i;let o=(0,s.parseDict)(a,t.bits,n.parse),c=new Map;for(let[e,n]of o)c.set((0,l.serializeInternalKey)(t.parse(e)),n);return new e(c,t,n)}constructor(e,t,n){this._key=t,this._value=n,this._map=e}get size(){return this._map.size}get(e){return this._map.get((0,l.serializeInternalKey)(e))}has(e){return this._map.has((0,l.serializeInternalKey)(e))}set(e,t){return this._map.set((0,l.serializeInternalKey)(e),t),this}delete(e){let t=(0,l.serializeInternalKey)(e);return this._map.delete(t)}clear(){this._map.clear()}*[Symbol.iterator](){for(let[e,t]of this._map)yield[(0,l.deserializeInternalKey)(e),t]}keys(){return Array.from(this._map.keys()).map(e=>(0,l.deserializeInternalKey)(e))}values(){return Array.from(this._map.values())}store(e,t,r){if(this._map.size===0)e.storeBit(0);else{let i=this._key;t!=null&&(i=t);let a=this._value;if(r!=null&&(a=r),!i)throw Error(`Key serializer is not defined`);if(!a)throw Error(`Value serializer is not defined`);let o=new Map;for(let[e,t]of this._map)o.set(i.serialize((0,l.deserializeInternalKey)(e)),t);e.storeBit(1);let s=(0,n.beginCell)();(0,c.serializeDict)(o,i.bits,a.serialize,s),e.storeRef(s.endCell())}}storeDirect(e,t,n){if(this._map.size===0)throw Error(`Cannot store empty dictionary directly`);let r=this._key;t!=null&&(r=t);let i=this._value;if(n!=null&&(i=n),!r)throw Error(`Key serializer is not defined`);if(!i)throw Error(`Value serializer is not defined`);let a=new Map;for(let[e,t]of this._map)a.set(r.serialize((0,l.deserializeInternalKey)(e)),t);(0,c.serializeDict)(a,r.bits,i.serialize,e)}generateMerkleProof(e){return(0,a.generateMerkleProof)(this,e,this._key)}generateMerkleProofDirect(e){return(0,a.generateMerkleProofDirect)(this,e,this._key)}generateMerkleUpdate(e,t){return(0,o.generateMerkleUpdate)(this,e,this._key,t)}};e.Dictionary=f,f.Keys={Address:()=>p(),BigInt:e=>m(e),Int:e=>h(e),BigUint:e=>g(e),Uint:e=>_(e),Buffer:e=>v(e),BitString:e=>y(e)},f.Values={BigInt:e=>x(e),Int:e=>b(e),BigVarInt:e=>S(e),BigUint:e=>w(e),Uint:e=>ee(e),BigVarUint:e=>C(e),Bool:()=>te(),Address:()=>T(),Cell:()=>E(),Buffer:e=>ne(e),BitString:e=>re(e),Dictionary:(e,t)=>D(e,t)};function p(){return{bits:267,serialize:e=>{if(!t.Address.isAddress(e))throw Error(`Key is not an address`);return(0,n.beginCell)().storeAddress(e).endCell().beginParse().preloadUintBig(267)},parse:e=>(0,n.beginCell)().storeUint(e,267).endCell().beginParse().loadAddress()}}function m(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadIntBig(e)}}function h(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadInt(e)}}function g(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)}}function _(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>Number((0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUint(e))}}function v(e){return{bits:e*8,serialize:t=>{if(!d.isBuffer(t))throw Error(`Key is not a buffer`);return(0,n.beginCell)().storeBuffer(t).endCell().beginParse().loadUintBig(e*8)},parse:t=>(0,n.beginCell)().storeUint(t,e*8).endCell().beginParse().loadBuffer(e)}}function y(e){return{bits:e,serialize:t=>{if(!i.BitString.isBitString(t))throw Error(`Key is not a BitString`);return(0,n.beginCell)().storeBits(t).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadBits(e)}}function b(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadInt(e);return t.endParse(),n}}}function x(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadIntBig(e);return t.endParse(),n}}}function S(e){return{serialize:(t,n)=>{n.storeVarInt(t,e)},parse:t=>{let n=t.loadVarIntBig(e);return t.endParse(),n}}}function C(e){return{serialize:(t,n)=>{n.storeVarUint(t,e)},parse:t=>{let n=t.loadVarUintBig(e);return t.endParse(),n}}}function ee(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUint(e);return t.endParse(),n}}}function w(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUintBig(e);return t.endParse(),n}}}function te(){return{serialize:(e,t)=>{t.storeBit(e)},parse:e=>{let t=e.loadBit();return e.endParse(),t}}}function T(){return{serialize:(e,t)=>{t.storeAddress(e)},parse:e=>{let t=e.loadAddress();return e.endParse(),t}}}function E(){return{serialize:(e,t)=>{t.storeRef(e)},parse:e=>{let t=e.loadRef();return e.endParse(),t}}}function D(e,t){return{serialize:(e,t)=>{e.store(t)},parse:n=>{let r=f.load(e,t,n);return n.endParse(),r}}}function ne(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid buffer size`);n.storeBuffer(t)},parse:t=>{let n=t.loadBuffer(e);return t.endParse(),n}}}function re(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid BitString size`);n.storeBits(t)},parse:t=>{let n=t.loadBits(e);return t.endParse(),n}}}})),cr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.writeString=e.stringToCell=e.readString=void 0;var t=Q();function n(e){if(e.remainingBits%8!=0)throw Error(`Invalid string length: ${e.remainingBits}`);if(e.remainingRefs!==0&&e.remainingRefs!==1)throw Error(`invalid number of refs: ${e.remainingRefs}`);let t;return t=e.remainingBits===0?d.alloc(0):e.loadBuffer(e.remainingBits/8),e.remainingRefs===1&&(t=d.concat([t,n(e.loadRef().beginParse())])),t}function r(e){return n(e).toString()}e.readString=r;function i(e,n){if(e.length>0){let r=Math.floor(n.availableBits/8);if(e.length>r){let a=e.subarray(0,r),o=e.subarray(r);n=n.storeBuffer(a);let s=(0,t.beginCell)();i(o,s),n=n.storeRef(s.endCell())}else n=n.storeBuffer(e)}}function a(e){let n=(0,t.beginCell)();return i(d.from(e),n),n.endCell()}e.stringToCell=a;function o(e,t){i(d.from(e),t)}e.writeString=o})),lr=e((e=>{var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.Slice=void 0;var n=Hn(),r=sr(),i=Q(),a=cr();e.Slice=class e{constructor(e,n){this[t]=()=>this.toString(),this._reader=e.clone(),this._refs=[...n],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(e){return this._reader.skip(e),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(e){return this._reader.loadBits(e)}preloadBits(e){return this._reader.preloadBits(e)}loadUint(e){return this._reader.loadUint(e)}loadUintBig(e){return this._reader.loadUintBig(e)}preloadUint(e){return this._reader.preloadUint(e)}preloadUintBig(e){return this._reader.preloadUintBig(e)}loadMaybeUint(e){return this.loadBit()?this.loadUint(e):null}loadMaybeUintBig(e){return this.loadBit()?this.loadUintBig(e):null}loadInt(e){return this._reader.loadInt(e)}loadIntBig(e){return this._reader.loadIntBig(e)}preloadInt(e){return this._reader.preloadInt(e)}preloadIntBig(e){return this._reader.preloadIntBig(e)}loadMaybeInt(e){return this.loadBit()?this.loadInt(e):null}loadMaybeIntBig(e){return this.loadBit()?this.loadIntBig(e):null}loadVarUint(e){return this._reader.loadVarUint(e)}loadVarUintBig(e){return this._reader.loadVarUintBig(e)}preloadVarUint(e){return this._reader.preloadVarUint(e)}preloadVarUintBig(e){return this._reader.preloadVarUintBig(e)}loadVarInt(e){return this._reader.loadVarInt(e)}loadVarIntBig(e){return this._reader.loadVarIntBig(e)}preloadVarInt(e){return this._reader.preloadVarInt(e)}preloadVarIntBig(e){return this._reader.preloadVarIntBig(e)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(e){return this._reader.loadBuffer(e)}preloadBuffer(e){return this._reader.preloadBuffer(e)}loadStringTail(){return(0,a.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,a.readString)(this):null}loadStringRefTail(){return(0,a.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){let e=this.loadMaybeRef();return e?(0,a.readString)(e.beginParse()):null}loadDict(e,t){return r.Dictionary.load(e,t,this)}loadDictDirect(e,t){return r.Dictionary.loadDirect(e,t,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw Error(`Slice is not empty`)}asCell(){return(0,i.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,i.beginCell)().storeSlice(this)}clone(t=!1){if(t){let t=this._reader.clone();return t.reset(),new e(t,this._refs)}else{let t=new e(this._reader,this._refs);return t._refsOffset=this._refsOffset,t}}toString(){return this.asCell().toString()}},t=n.inspectSymbol})),ur=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.exoticLibrary=void 0;var t=$n();function n(e,n){let r=new t.BitReader(e);if(e.length!==264)throw Error(`Library cell must have exactly (8 + 256) bits, got "${e.length}"`);let i=r.loadUint(8);if(i!==2)throw Error(`Library cell must have type 2, got "${i}"`);return{}}e.exoticLibrary=n})),dr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.exoticMerkleUpdate=void 0;var t=$n();function n(e,n){let r=new t.BitReader(e);if(e.length!==552)throw Error(`Merkle Update cell must have exactly (8 + (2 * (256 + 16))) bits, got "${e.length}"`);if(n.length!==2)throw Error(`Merkle Update cell must have exactly 2 refs, got "${n.length}"`);let i=r.loadUint(8);if(i!==4)throw Error(`Merkle Update cell type must be exactly 4, got "${i}"`);let a=r.loadBuffer(32),o=r.loadBuffer(32),s=r.loadUint(16),c=r.loadUint(16);if(s!==n[0].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${s}", got "${n[0].depth(0)}"`);if(!a.equals(n[0].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${a.toString(`hex`)}", got "${n[0].hash(0).toString(`hex`)}"`);if(c!==n[1].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${c}", got "${n[1].depth(0)}"`);if(!o.equals(n[1].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${o.toString(`hex`)}", got "${n[1].hash(0).toString(`hex`)}"`);return{proofDepth1:s,proofDepth2:c,proofHash1:a,proofHash2:o}}e.exoticMerkleUpdate=n})),fr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LevelMask=void 0,e.LevelMask=class e{constructor(e=0){this._mask=0,this._mask=e,this._hashIndex=t(this._mask),this._hashCount=this._hashIndex+1}get value(){return this._mask}get level(){return 32-Math.clz32(this._mask)}get hashIndex(){return this._hashIndex}get hashCount(){return this._hashCount}apply(t){return new e(this._mask&(1<<t)-1)}isSignificant(e){return e===0||(this._mask>>e-1)%2!=0}};function t(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}})),pr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.exoticPruned=void 0;var t=$n(),n=fr();function r(e,r){let i=new t.BitReader(e),a=i.loadUint(8);if(a!==1)throw Error(`Pruned branch cell must have type 1, got "${a}"`);if(r.length!==0)throw Error(`Pruned Branch cell can't has refs, got "${r.length}"`);let o;if(e.length===280)o=new n.LevelMask(1);else{if(o=new n.LevelMask(i.loadUint(8)),o.level<1||o.level>3)throw Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${o.level}/${o.value}"`);let t=16+o.apply(o.level-1).hashCount*272;if(e.length!==t)throw Error(`Pruned branch cell must have exactly ${t} bits, got "${e.length}"`)}let s=[],c=[],l=[];for(let e=0;e<o.level;e++)c.push(i.loadBuffer(32));for(let e=0;e<o.level;e++)l.push(i.loadUint(16));for(let e=0;e<o.level;e++)s.push({depth:l[e],hash:c[e]});return{mask:o.value,pruned:s}}e.exoticPruned=r})),mr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveExotic=void 0;var t=$n(),n=Zn(),r=ur(),i=er(),a=dr(),o=pr(),s=fr();function c(e,t){let r=(0,o.exoticPruned)(e,t),i=[],a=[],c=new s.LevelMask(r.mask);for(let e=0;e<r.pruned.length;e++)i.push(r.pruned[e].depth),a.push(r.pruned[e].hash);return{type:n.CellType.PrunedBranch,depths:i,hashes:a,mask:c}}function l(e,t){(0,r.exoticLibrary)(e,t);let i=[],a=[],o=new s.LevelMask;return{type:n.CellType.Library,depths:i,hashes:a,mask:o}}function u(e,t){(0,i.exoticMerkleProof)(e,t);let r=[],a=[],o=new s.LevelMask(t[0].level()>>1);return{type:n.CellType.MerkleProof,depths:r,hashes:a,mask:o}}function d(e,t){(0,a.exoticMerkleUpdate)(e,t);let r=[],i=[],o=new s.LevelMask((t[0].level()|t[1].level())>>1);return{type:n.CellType.MerkleUpdate,depths:r,hashes:i,mask:o}}function f(e,n){let r=new t.BitReader(e).preloadUint(8);if(r===1)return c(e,n);if(r===2)return l(e,n);if(r===3)return u(e,n);if(r===4)return d(e,n);throw Error(`Invalid exotic cell type: `+r)}e.resolveExotic=f})),hr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.getRepr=e.getBitsDescriptor=e.getRefsDescriptor=void 0;var t=Zn(),n=Jn();function r(e,n,r){return e.length+(r===t.CellType.Ordinary?0:1)*8+n*32}e.getRefsDescriptor=r;function i(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}e.getBitsDescriptor=i;function a(e,a,o,s,c,l){let u=Math.ceil(a.length/8),f=d.alloc(2+u+34*o.length),p=0;f[p++]=r(o,c,l),f[p++]=i(e),(0,n.bitsToPaddedBuffer)(a).copy(f,p),p+=u;for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.depth(s+1):e.depth(s),f[p++]=Math.floor(n/256),f[p++]=n%256}for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.hash(s+1):e.hash(s),n.copy(f,p),p+=32}return f}e.getRepr=a})),gr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.wonderCalculator=void 0;var t=Yn(),n=Zn(),r=fr(),i=pr(),a=er(),o=hr(),s=ie(),c=dr(),l=ur();function u(e,u,d){let f,p=null;if(e===n.CellType.Ordinary){let e=0;for(let t of d)e|=t.mask.value;f=new r.LevelMask(e)}else if(e===n.CellType.PrunedBranch)p=(0,i.exoticPruned)(u,d),f=new r.LevelMask(p.mask);else if(e===n.CellType.MerkleProof)(0,a.exoticMerkleProof)(u,d),f=new r.LevelMask(d[0].mask.value>>1);else if(e===n.CellType.MerkleUpdate)(0,c.exoticMerkleUpdate)(u,d),f=new r.LevelMask((d[0].mask.value|d[1].mask.value)>>1);else if(e===n.CellType.Library)(0,l.exoticLibrary)(u,d),f=new r.LevelMask;else throw Error(`Unsupported exotic type`);let m=[],h=[],g=e===n.CellType.PrunedBranch?1:f.hashCount,_=f.hashCount-g;for(let r=0,i=0;r<=f.level;r++){if(!f.isSignificant(r))continue;if(i<_){i++;continue}let a;if(i===_){if(!(r===0||e===n.CellType.PrunedBranch))throw Error(`Invalid`);a=u}else{if(!(r!==0&&e!==n.CellType.PrunedBranch))throw Error(`Invalid: `+r+`, `+e);a=new t.BitString(h[i-_-1],0,256)}let c=0;for(let t of d){let i;i=e==n.CellType.MerkleProof||e==n.CellType.MerkleUpdate?t.depth(r+1):t.depth(r),c=Math.max(c,i)}d.length>0&&c++;let l=(0,o.getRepr)(u,a,d,r,f.apply(r).value,e),p=(0,s.sha256_sync)(l),g=i-_;m[g]=c,h[g]=p,i++}let v=[],y=[];if(p)for(let e=0;e<4;e++){let{hashIndex:t}=f.apply(e),{hashIndex:n}=f;t===n?(v.push(h[0]),y.push(m[0])):(v.push(p.pruned[t].hash),y.push(p.pruned[t].depth))}else for(let e=0;e<4;e++)v.push(h[f.apply(e).hashIndex]),y.push(m[f.apply(e).hashIndex]);return{mask:f,hashes:v,depths:y}}e.wonderCalculator=u})),_r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.topologicalSort=void 0;function t(e){let t=[e],n=new Map,r=new Set,i=[];for(;t.length>0;){let e=[...t];t=[];for(let i of e){let e=i.hash().toString(`hex`);if(!n.has(e)){r.add(e),n.set(e,{cell:i,refs:i.refs.map(e=>e.hash().toString(`hex`))});for(let e of i.refs)t.push(e)}}}let a=new Set;function o(e){if(!r.has(e))return;if(a.has(e))throw Error(`Not a DAG`);a.add(e);let t=n.get(e).refs;for(let e=t.length-1;e>=0;e--)o(t[e]);i.push(e),a.delete(e),r.delete(e)}for(;r.size>0;){let e=Array.from(r)[0];o(e)}let s=new Map;for(let e=0;e<i.length;e++)s.set(i[i.length-e-1],e);let c=[];for(let e=i.length-1;e>=0;e--){let t=i[e],r=n.get(t);c.push({cell:r.cell,refs:r.refs.map(e=>s.get(e))})}return c}e.topologicalSort=t})),vr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.bitsForNumber=void 0;function t(e,t){let n=BigInt(e);if(t===`int`)return n===0n||n===-1n?1:(n>0?n:-n).toString(2).length+1;if(t===`uint`){if(n<0)throw Error(`value is negative. Got ${e}`);return n.toString(2).length}else throw Error(`invalid mode. Got ${t}`)}e.bitsForNumber=t})),yr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.crc32c=void 0;var t=2197175160;function n(e){let n=-1;for(let r=0;r<e.length;r++)n^=e[r],n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1;n^=4294967295;let r=d.alloc(4);return r.writeInt32LE(n),r}e.crc32c=n})),br=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serializeBoc=e.deserializeBoc=e.parseBoc=void 0;var t=$n(),n=Yn(),r=xr(),i=_r(),a=vr(),o=Xn(),s=hr(),c=Jn(),l=yr();function u(e){return d(e&7)}function d(e){let t=0;for(let n=0;n<3;n++)t+=e&1,e>>=1;return t+1}function f(e,t){let r=e.loadUint(8),i=r%8,a=!!(r&8),o=e.loadUint(8),s=Math.ceil(o/2),c=!!(o%2),l=r>>5,d=(r&16)!=0,f=d?u(l)*32:0,p=d?u(l)*2:0;e.skip(f*8),e.skip(p*8);let m=n.BitString.EMPTY;s>0&&(m=c?e.loadPaddedBits(s*8):e.loadBits(s*8));let h=[];for(let n=0;n<i;n++)h.push(e.loadUint(t*8));return{bits:m,refs:h,exotic:a}}function p(e,t){return 2+Math.ceil(e.bits.length/8)+e.refs.length*t}function m(e){let r=new t.BitReader(new n.BitString(e,0,e.length*8)),i=r.loadUint(32);if(i===1761568243){let e=r.loadUint(8),t=r.loadUint(8),n=r.loadUint(e*8),i=r.loadUint(e*8),a=r.loadUint(e*8),o=r.loadUint(t*8);return{size:e,offBytes:t,cells:n,roots:i,absent:a,totalCellSize:o,index:r.loadBuffer(n*t),cellData:r.loadBuffer(o),root:[0]}}else if(i===2898503464){let t=r.loadUint(8),n=r.loadUint(8),i=r.loadUint(t*8),a=r.loadUint(t*8),o=r.loadUint(t*8),s=r.loadUint(n*8),c=r.loadBuffer(i*n),u=r.loadBuffer(s),d=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(d))throw Error(`Invalid CRC32C`);return{size:t,offBytes:n,cells:i,roots:a,absent:o,totalCellSize:s,index:c,cellData:u,root:[0]}}else if(i===3052313714){let t=r.loadUint(1),n=r.loadUint(1);r.loadUint(1),r.loadUint(2);let i=r.loadUint(3),a=r.loadUint(8),o=r.loadUint(i*8),s=r.loadUint(i*8),c=r.loadUint(i*8),u=r.loadUint(a*8),d=[];for(let e=0;e<s;e++)d.push(r.loadUint(i*8));let f=null;t&&(f=r.loadBuffer(o*a));let p=r.loadBuffer(u);if(n){let t=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(t))throw Error(`Invalid CRC32C`)}return{size:i,offBytes:a,cells:o,roots:s,absent:c,totalCellSize:u,index:f,cellData:p,root:d}}else throw Error(`Invalid magic`)}e.parseBoc=m;function h(e){let i=m(e),a=new t.BitReader(new n.BitString(i.cellData,0,i.cellData.length*8)),o=[];for(let e=0;e<i.cells;e++){let e=f(a,i.size);o.push({...e,result:null})}for(let e=o.length-1;e>=0;e--){if(o[e].result)throw Error(`Impossible`);let t=[];for(let n of o[e].refs){if(!o[n].result)throw Error(`Invalid BOC file`);t.push(o[n].result)}o[e].result=new r.Cell({bits:o[e].bits,refs:t,exotic:o[e].exotic})}let s=[];for(let e=0;e<i.root.length;e++)s.push(o[i.root[e]].result);return s}e.deserializeBoc=h;function g(e,t,n,r){let i=(0,s.getRefsDescriptor)(e.refs,e.mask.value,e.type),a=(0,s.getBitsDescriptor)(e.bits);r.writeUint(i,8),r.writeUint(a,8),r.writeBuffer((0,c.bitsToPaddedBuffer)(e.bits));for(let e of t)r.writeUint(e,n*8)}function _(e,t){let n=(0,i.topologicalSort)(e),r=n.length,s=t.idx,c=t.crc32,u=Math.max(Math.ceil((0,a.bitsForNumber)(r,`uint`)/8),1),d=0,f=[];for(let e of n){let t=p(e.cell,u);d+=t,f.push(d)}let m=Math.max(Math.ceil((0,a.bitsForNumber)(d,`uint`)/8),1),h=(6+3*u+m+1*u+(s?r*m:0)+d+(c?4:0))*8,_=new o.BitBuilder(h);if(_.writeUint(3052313714,32),_.writeBit(s),_.writeBit(c),_.writeBit(!1),_.writeUint(0,2),_.writeUint(u,3),_.writeUint(m,8),_.writeUint(r,u*8),_.writeUint(1,u*8),_.writeUint(0,u*8),_.writeUint(d,m*8),_.writeUint(0,u*8),s)for(let e=0;e<r;e++)_.writeUint(f[e],m*8);for(let e=0;e<r;e++)g(n[e].cell,n[e].refs,u,_);if(c){let e=(0,l.crc32c)(_.buffer());_.writeBuffer(e)}let v=_.buffer();if(v.length!==h/8)throw Error(`Internal error`);return v}e.serializeBoc=_})),xr=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.Cell=void 0;var n=Hn(),r=Yn(),i=Zn(),a=lr(),o=mr(),s=gr(),c=br(),l=$n(),f=Q(),p=class e{static fromBoc(e){return(0,c.deserializeBoc)(e)}static fromBase64(t){let n=e.fromBoc(d.from(t,`base64`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}static fromHex(t){let n=e.fromBoc(d.from(t,`hex`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}constructor(e){this._hashes=[],this._depths=[],this.beginParse=(e=!1)=>{if(this.isExotic&&!e)throw Error(`Exotic cells cannot be parsed`);return new a.Slice(new l.BitReader(this.bits),this.refs)},this.hash=(e=3)=>this._hashes[Math.min(this._hashes.length-1,e)],this.depth=(e=3)=>this._depths[Math.min(this._depths.length-1,e)],this.level=()=>this.mask.level,this.equals=e=>this.hash().equals(e.hash()),this[t]=()=>this.toString();let n=r.BitString.EMPTY;e&&e.bits&&(n=e.bits);let c=[];e&&e.refs&&(c=[...e.refs]);let u,d,f,p=i.CellType.Ordinary;if(e&&e.exotic){let e=(0,o.resolveExotic)(n,c),t=(0,s.wonderCalculator)(e.type,n,c);f=t.mask,d=t.depths,u=t.hashes,p=e.type}else{if(c.length>4)throw Error(`Invalid number of references`);if(n.length>1023)throw Error(`Bits overflow: ${n.length} > 1023`);let e=(0,s.wonderCalculator)(i.CellType.Ordinary,n,c);f=e.mask,d=e.depths,u=e.hashes,p=i.CellType.Ordinary}this.type=p,this.bits=n,this.refs=c,this.mask=f,this._depths=d,this._hashes=u,Object.freeze(this),Object.freeze(this.refs),Object.freeze(this.bits),Object.freeze(this.mask),Object.freeze(this._depths),Object.freeze(this._hashes)}get isExotic(){return this.type!==i.CellType.Ordinary}toBoc(e){let t=e&&e.idx!==null&&e.idx!==void 0?e.idx:!1,n=e&&e.crc32!==null&&e.crc32!==void 0?e.crc32:!0;return(0,c.serializeBoc)(this,{idx:t,crc32:n})}toString(e){let t=e||``,n=`x`;this.isExotic&&(this.type===i.CellType.MerkleProof?n=`p`:this.type===i.CellType.MerkleUpdate?n=`u`:this.type===i.CellType.PrunedBranch&&(n=`p`));let r=t+(this.isExotic?n:`x`)+`{`+this.bits.toString()+`}`;for(let e in this.refs){let n=this.refs[e];r+=`
1
+ import{t as e}from"./chunk-CzyJ72yW.js";import{C as t,G as n,K as r,O as i,T as a,U as o,W as s,n as c,t as l}from"./createConnector-BcHSC56W.js";import{i as u,t as d}from"./dist-rLdy04_b.js";import{t as f}from"./toBytes-DiTqRJTE.js";import{a as p,n as m,r as h,t as g}from"./networks-CWeJ1anG.js";import{c as _,s as v,t as y}from"./Transport-D-_yOZ73.js";import{$ as b,C as x,D as S,O as C,T as ee,at as w,et as te,it as T,rt as E,w as D,x as ne}from"./index-BIOEiLJw.js";import{t as re}from"./v4-BcCgZyuS.js";import{n as ie,t as ae}from"./dist-Dtx-4lnI.js";import{t as oe}from"./registry-DLj0P6dj.js";var se=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ce=Math.ceil,le=Math.floor,O=`[BigNumber Error] `,ue=O+`Number primitive has more than 15 significant digits: `,de=0x5af3107a4000,k=14,fe=9007199254740991,pe=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],me=1e7,A=1e9;function he(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!se.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(j(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(ue+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>fe||e!==le(e)))throw Error(ue+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%k,l<0&&(f+=k),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=k;f<m;)y.c.push(+h.slice(f,f+=k));f=k-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=he,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],j(n,0,A,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],j(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(j(n[0],-A,0,t),j(n[1],0,A,t),c=n[0],l=n[1]):(j(n,-A,A,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)j(n[0],-A,-1,t),j(n[1],1,A,t),u=n[0],d=n[1];else if(j(n,-A,A,t),n)u=-(d=n<0?-n:n);else throw Error(O+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(O+`crypto unavailable`);else f=n;else throw Error(O+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],j(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],j(n,0,A,t),m=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)h=n;else throw Error(O+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(O+t+` invalid: `+n)}else throw Error(O+`Object expected: `+e);return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-A&&i<=A&&i===le(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%k,t<1&&(t+=k),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=de||n!==le(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(O+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return le(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:j(e,0,A),s=ce(e/k),f)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(O+`crypto unavailable`);if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=k,s&&e&&(c=pe[k-e],u[l]=le(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=k);for(l=1,c=u[0];c>=10;c/=10,l++);l<k&&(i-=k-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(xe(_e(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?xe(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=xe(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%me,u=t/me|0;for(e=e.slice();c--;)a=e[c]%me,o=e[c]/me|0,r=u*a+o*l,i=l*a+r%me*me+s,s=(i/n|0)+(r/me|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,ee,w,te,T=r.s==i.s?1:-1,E=r.c,D=i.c;if(!E||!E[0]||!D||!D[0])return new v(!r.s||!i.s||(E?D&&E[0]==D[0]:!D)?NaN:E&&E[0]==0||!D?T*0:T/0);for(h=new v(T),g=h.c=[],l=r.e-i.e,T=a+l+1,s||(s=de,l=ge(r.e/k)-ge(i.e/k),T=T/k|0),u=0;D[u]==(E[u]||0);u++);if(D[u]>(E[u]||0)&&l--,T<0)g.push(1),d=!0;else{for(C=E.length,w=D.length,u=0,T+=2,f=le(s/(D[0]+1)),f>1&&(D=e(D,f,s),E=e(E,f,s),w=D.length,C=E.length),x=w,_=E.slice(0,w),y=_.length;y<w;_[y++]=0);te=D.slice(),te=[0].concat(te),ee=D[0],D[1]>=s/2&&ee++;do{if(f=0,c=t(D,_,w,y),c<0){if(b=_[0],w!=y&&(b=b*s+(_[1]||0)),f=le(b/ee),f>1)for(f>=s&&(f=s-1),p=e(D,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,w<m?te:D,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=D.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(D,_,w,y)<1;)f++,n(_,w<y?te:D,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=E[x]||0:(_=[E[x]],y=1)}while((x++<C||_[0]!=null)&&T--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==de){for(u=1,T=g[0];T>=10;T/=10,u++);S(h,a+(h.e=u+l*k-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:j(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=_e(e.c),d=r==1||r==2&&(o<=c||o>=l)?be(d,o):xe(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=_e(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=be(d,a)}else if(t-=o+(r===2&&a>o),d=xe(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=ve(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*k-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(O+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=pe;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=k,o=t,c=p[l=0],f=le(c/m[i-o-1]%10);else if(l=ce((a+1)/k),l>=p.length)if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=k,o=a-k+1}else break out;else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=k,o=a-k+i,f=o<0?0:le(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(k-t%k)%k],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[k-a],p[l]=o>0?le(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==de&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=de)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=_e(e.c),t=n<=c||n>=l?be(t,n):xe(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return ve(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return j(e,0,A),t==null?t=s:j(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-ge(this.e/k))*k,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(O+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-ye(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&ye(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=ce(m/k+2));for(l?(n=new v(.5),u&&(e.s=1),d=ye(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=le(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=ye(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:j(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return ve(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return ve(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=ve(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&ge(this.e/k)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return ve(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=ve(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/k,u=e.e/k,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=ge(l),u=ge(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=de-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=de}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=ge(_.e/k)+ge(e.e/k),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=de,g=me,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/k,o=e.e/k,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=ge(a),o=ge(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/de|0,s[t]=de===s[t]?0:s[t]%de;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return j(e,1,A),t==null?t=s:j(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*k+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return j(e,-fe,fe),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=_e(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=ge((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),_e(a.c).slice(0,u)===(n=_e(r.c)).slice(0,u))if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(j(e,0,A),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(j(e,0,A),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(O+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(O+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=_e(y),c=n.e=g.length-_.e-1,n.c[0]=pe[(l=c%k)<0?k+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&j(e,1,A),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?be(_e(r.c),a):xe(_e(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=xe(_e(r.c),r.e,`0`)):(j(e,2,g.length,`Base`),t=n(xe(_e(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function ge(e){var t=e|0;return e>0||e===t?t:t-1}function _e(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=k-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function ve(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function j(e,t,n,r){if(e<t||e>n||e!==le(e))throw Error(O+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function ye(e){var t=e.c.length-1;return ge(e.e/k)==t&&e.c[t]%2!=0}function be(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function xe(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var M=he();function Se({id:e,name:t,address:n,currency:r,balance:i,spendableBalance:a,blockHeight:o,lastSyncDate:s,parentAccountId:c}){return{id:e,name:t,address:n,currency:r,balance:new M(i),spendableBalance:new M(a),blockHeight:o,lastSyncDate:new Date(s),parentAccountId:c}}var N;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(N||={});var Ce;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ce||={});var P=N.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),we=e=>{switch(typeof e){case`undefined`:return P.undefined;case`string`:return P.string;case`number`:return Number.isNaN(e)?P.nan:P.number;case`boolean`:return P.boolean;case`function`:return P.function;case`bigint`:return P.bigint;case`symbol`:return P.symbol;case`object`:return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?P.promise:typeof Map<`u`&&e instanceof Map?P.map:typeof Set<`u`&&e instanceof Set?P.set:typeof Date<`u`&&e instanceof Date?P.date:P.object;default:return P.unknown}},F=N.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Te=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Te.create=e=>new Te(e);var Ee=(e,t)=>{let n;switch(e.code){case F.invalid_type:n=e.received===P.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case F.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,N.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:n=`Unrecognized key(s) in object: ${N.joinValues(e.keys,`, `)}`;break;case F.invalid_union:n=`Invalid input`;break;case F.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${N.joinValues(e.options)}`;break;case F.invalid_enum_value:n=`Invalid enum value. Expected ${N.joinValues(e.options)}, received '${e.received}'`;break;case F.invalid_arguments:n=`Invalid function arguments`;break;case F.invalid_return_type:n=`Invalid function return type`;break;case F.invalid_date:n=`Invalid date`;break;case F.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:N.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case F.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case F.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case F.custom:n=`Invalid input`;break;case F.invalid_intersection_types:n=`Intersection results could not be merged`;break;case F.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case F.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,N.assertNever(e)}return{message:n}},De=Ee;function Oe(){return De}var ke=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function I(e,t){let n=Oe(),r=ke({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ee?void 0:Ee].filter(e=>!!e)});e.common.issues.push(r)}var Ae=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return L;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return L;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},L=Object.freeze({status:`aborted`}),je=e=>({status:`dirty`,value:e}),Me=e=>({status:`valid`,value:e}),Ne=e=>e.status===`aborted`,Pe=e=>e.status===`dirty`,Fe=e=>e.status===`valid`,Ie=e=>typeof Promise<`u`&&e instanceof Promise,R;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(R||={});var Le=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Re=(e,t)=>{if(Fe(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Te(e.common.issues);return this._error=t,this._error}}};function z(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var B=class{get description(){return this._def.description}_getType(e){return we(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ae,ctx:{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ie(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)};return Re(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Fe(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Fe(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)},r=this._parse({data:e,path:n.path,parent:n});return Re(n,await(Ie(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:F.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new Vt({schema:this,typeName:V.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Ht.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return St.create(this)}promise(){return Bt.create(this,this._def)}or(e){return Tt.create([this,e],this._def)}and(e){return kt.create(this,e,this._def)}transform(e){return new Vt({...z(this._def),schema:this,typeName:V.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Wt({...z(this._def),innerType:this,defaultValue:t,typeName:V.ZodDefault})}brand(){return new qt({typeName:V.ZodBranded,type:this,...z(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Gt({...z(this._def),innerType:this,catchValue:t,typeName:V.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Jt.create(this,e)}readonly(){return Yt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ze=/^c[^\s-]{8,}$/i,Be=/^[0-9a-z]+$/,Ve=/^[0-9A-HJKMNP-TV-Z]{26}$/i,He=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ue=/^[a-z0-9_-]{21}$/i,We=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ge=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ke=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Je,Ye=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ze=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tt=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,nt=RegExp(`^${tt}$`);function rt(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function it(e){return RegExp(`^${rt(e)}$`)}function at(e){let t=`${tt}T${rt(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ot(e,t){return!!((t===`v4`||!t)&&Ye.test(e)||(t===`v6`||!t)&&Ze.test(e))}function st(e,t){if(!We.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function ct(e,t){return!!((t===`v4`||!t)&&Xe.test(e)||(t===`v6`||!t)&&Qe.test(e))}var lt=class e extends B{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.string,received:t.parsedType}),L}let t=new Ae,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?I(n,{code:F.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&I(n,{code:F.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Ke.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`email`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Je||=new RegExp(qe,`u`),Je.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`emoji`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)He.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`uuid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Ue.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`nanoid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ze.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`cuid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Be.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`cuid2`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`ulid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),I(n,{validation:`url`,code:F.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`regex`,code:F.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?at(r).test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?nt.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?it(r).test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:F.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`duration`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?ot(e.data,r.version)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`ip`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?st(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`jwt`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?ct(e.data,r.version)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`cidr`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?$e.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`base64`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?et.test(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{validation:`base64url`,code:F.invalid_string,message:r.message}),t.dirty()):N.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:F.invalid_string,...R.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...R.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...R.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...R.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...R.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...R.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...R.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...R.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...R.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...R.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...R.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...R.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...R.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};lt.create=e=>new lt({checks:[],typeName:V.ZodString,coerce:e?.coerce??!1,...z(e)});function ut(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var dt=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==P.number){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.number,received:t.parsedType}),L}let t,n=new Ae;for(let r of this._def.checks)r.kind===`int`?N.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),I(t,{code:F.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?ut(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),I(t,{code:F.not_finite,message:r.message}),n.dirty()):N.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,R.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,R.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,R.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,R.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:R.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:R.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:R.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:R.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:R.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&N.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};dt.create=e=>new dt({checks:[],typeName:V.ZodNumber,coerce:e?.coerce||!1,...z(e)});var ft=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==P.bigint)return this._getInvalidInput(e);let t,n=new Ae;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),I(t,{code:F.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):N.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit(`min`,e,!0,R.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,R.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,R.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,R.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:R.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:R.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ft.create=e=>new ft({checks:[],typeName:V.ZodBigInt,coerce:e?.coerce??!1,...z(e)});var pt=class extends B{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==P.boolean){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.boolean,received:t.parsedType}),L}return Me(e.data)}};pt.create=e=>new pt({typeName:V.ZodBoolean,coerce:e?.coerce||!1,...z(e)});var mt=class e extends B{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.date,received:t.parsedType}),L}if(Number.isNaN(e.data.getTime()))return I(this._getOrReturnCtx(e),{code:F.invalid_date}),L;let t=new Ae,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),I(n,{code:F.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):N.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};mt.create=e=>new mt({checks:[],coerce:e?.coerce||!1,typeName:V.ZodDate,...z(e)});var ht=class extends B{_parse(e){if(this._getType(e)!==P.symbol){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.symbol,received:t.parsedType}),L}return Me(e.data)}};ht.create=e=>new ht({typeName:V.ZodSymbol,...z(e)});var gt=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.undefined,received:t.parsedType}),L}return Me(e.data)}};gt.create=e=>new gt({typeName:V.ZodUndefined,...z(e)});var _t=class extends B{_parse(e){if(this._getType(e)!==P.null){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.null,received:t.parsedType}),L}return Me(e.data)}};_t.create=e=>new _t({typeName:V.ZodNull,...z(e)});var vt=class extends B{constructor(){super(...arguments),this._any=!0}_parse(e){return Me(e.data)}};vt.create=e=>new vt({typeName:V.ZodAny,...z(e)});var yt=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Me(e.data)}};yt.create=e=>new yt({typeName:V.ZodUnknown,...z(e)});var bt=class extends B{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.never,received:t.parsedType}),L}};bt.create=e=>new bt({typeName:V.ZodNever,...z(e)});var xt=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.void,received:t.parsedType}),L}return Me(e.data)}};xt.create=e=>new xt({typeName:V.ZodVoid,...z(e)});var St=class e extends B{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==P.array)return I(t,{code:F.invalid_type,expected:P.array,received:t.parsedType}),L;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(I(t,{code:e?F.too_big:F.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(I(t,{code:F.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(I(t,{code:F.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Le(t,e,t.path,n)))).then(e=>Ae.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Le(t,e,t.path,n)));return Ae.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:R.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:R.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:R.toString(n)}})}nonempty(e){return this.min(1,e)}};St.create=(e,t)=>new St({type:e,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...z(t)});function Ct(e){if(e instanceof wt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ht.create(Ct(r))}return new wt({...e._def,shape:()=>t})}else if(e instanceof St)return new St({...e._def,type:Ct(e.element)});else if(e instanceof Ht)return Ht.create(Ct(e.unwrap()));else if(e instanceof Ut)return Ut.create(Ct(e.unwrap()));else if(e instanceof At)return At.create(e.items.map(e=>Ct(e)));else return e}var wt=class e extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=N.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==P.object){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.object,received:t.parsedType}),L}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof bt&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Le(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof bt){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(I(n,{code:F.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Le(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Ae.mergeObjectSync(t,e)):Ae.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return R.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:R.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:V.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of N.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of N.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Ct(this)}partial(t){let n={};for(let e of N.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of N.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ht;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Lt(N.objectKeys(this.shape))}};wt.create=(e,t)=>new wt({shape:()=>e,unknownKeys:`strip`,catchall:bt.create(),typeName:V.ZodObject,...z(t)}),wt.strictCreate=(e,t)=>new wt({shape:()=>e,unknownKeys:`strict`,catchall:bt.create(),typeName:V.ZodObject,...z(t)}),wt.lazycreate=(e,t)=>new wt({shape:e,unknownKeys:`strip`,catchall:bt.create(),typeName:V.ZodObject,...z(t)});var Tt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Te(e.ctx.common.issues));return I(t,{code:F.invalid_union,unionErrors:n}),L}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Te(e));return I(t,{code:F.invalid_union,unionErrors:i}),L}}get options(){return this._def.options}};Tt.create=(e,t)=>new Tt({options:e,typeName:V.ZodUnion,...z(t)});var Et=e=>e instanceof Ft?Et(e.schema):e instanceof Vt?Et(e.innerType()):e instanceof It?[e.value]:e instanceof Rt?e.options:e instanceof zt?N.objectValues(e.enum):e instanceof Wt?Et(e._def.innerType):e instanceof gt?[void 0]:e instanceof _t?[null]:e instanceof Ht?[void 0,...Et(e.unwrap())]:e instanceof Ut?[null,...Et(e.unwrap())]:e instanceof qt||e instanceof Yt?Et(e.unwrap()):e instanceof Gt?Et(e._def.innerType):[],Dt=class e extends B{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.object)return I(t,{code:F.invalid_type,expected:P.object,received:t.parsedType}),L;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(I(t,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Et(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:V.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...z(r)})}};function Ot(e,t){let n=we(e),r=we(t);if(e===t)return{valid:!0,data:e};if(n===P.object&&r===P.object){let n=N.objectKeys(t),r=N.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ot(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===P.array&&r===P.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ot(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===P.date&&r===P.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var kt=class extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Ne(e)||Ne(r))return L;let i=Ot(e.value,r.value);return i.valid?((Pe(e)||Pe(r))&&t.dirty(),{status:t.value,value:i.data}):(I(n,{code:F.invalid_intersection_types}),L)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};kt.create=(e,t,n)=>new kt({left:e,right:t,typeName:V.ZodIntersection,...z(n)});var At=class e extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.array)return I(n,{code:F.invalid_type,expected:P.array,received:n.parsedType}),L;if(n.data.length<this._def.items.length)return I(n,{code:F.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),L;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Le(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Ae.mergeArray(t,e)):Ae.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};At.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new At({items:e,typeName:V.ZodTuple,rest:null,...z(t)})};var jt=class e extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.object)return I(n,{code:F.invalid_type,expected:P.object,received:n.parsedType}),L;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Le(n,e,n.path,e)),value:a._parse(new Le(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ae.mergeObjectAsync(t,r):Ae.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof B?new e({keyType:t,valueType:n,typeName:V.ZodRecord,...z(r)}):new e({keyType:lt.create(),valueType:t,typeName:V.ZodRecord,...z(n)})}},Mt=class extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.map)return I(n,{code:F.invalid_type,expected:P.map,received:n.parsedType}),L;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Le(n,e,n.path,[a,`key`])),value:i._parse(new Le(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return L;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return L;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Mt.create=(e,t,n)=>new Mt({valueType:t,keyType:e,typeName:V.ZodMap,...z(n)});var Nt=class e extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.set)return I(n,{code:F.invalid_type,expected:P.set,received:n.parsedType}),L;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(I(n,{code:F.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(I(n,{code:F.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return L;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Le(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:R.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:R.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Nt.create=(e,t)=>new Nt({valueType:e,minSize:null,maxSize:null,typeName:V.ZodSet,...z(t)});var Pt=class e extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.function)return I(t,{code:F.invalid_type,expected:P.function,received:t.parsedType}),L;function n(e,n){return ke({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oe(),Ee].filter(e=>!!e),issueData:{code:F.invalid_arguments,argumentsError:n}})}function r(e,n){return ke({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oe(),Ee].filter(e=>!!e),issueData:{code:F.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Bt){let e=this;return Me(async function(...t){let o=new Te([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return Me(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Te([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Te([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:At.create(t).rest(yt.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||At.create([]).rest(yt.create()),returns:n||yt.create(),typeName:V.ZodFunction,...z(r)})}},Ft=class extends B{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ft.create=(e,t)=>new Ft({getter:e,typeName:V.ZodLazy,...z(t)});var It=class extends B{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:F.invalid_literal,expected:this._def.value}),L}return{status:`valid`,value:e.data}}get value(){return this._def.value}};It.create=(e,t)=>new It({value:e,typeName:V.ZodLiteral,...z(t)});function Lt(e,t){return new Rt({values:e,typeName:V.ZodEnum,...z(t)})}var Rt=class e extends B{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return I(t,{expected:N.joinValues(n),received:t.parsedType,code:F.invalid_type}),L}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return I(t,{received:t.data,code:F.invalid_enum_value,options:n}),L}return Me(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Rt.create=Lt;var zt=class extends B{_parse(e){let t=N.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==P.string&&n.parsedType!==P.number){let e=N.objectValues(t);return I(n,{expected:N.joinValues(e),received:n.parsedType,code:F.invalid_type}),L}if(this._cache||=new Set(N.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=N.objectValues(t);return I(n,{received:n.data,code:F.invalid_enum_value,options:e}),L}return Me(e.data)}get enum(){return this._def.values}};zt.create=(e,t)=>new zt({values:e,typeName:V.ZodNativeEnum,...z(t)});var Bt=class extends B{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==P.promise&&t.common.async===!1?(I(t,{code:F.invalid_type,expected:P.promise,received:t.parsedType}),L):Me((t.parsedType===P.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Bt.create=(e,t)=>new Bt({type:e,typeName:V.ZodPromise,...z(t)});var Vt=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{I(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return L;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?L:r.status===`dirty`||t.value===`dirty`?je(r.value):r});{if(t.value===`aborted`)return L;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?L:r.status===`dirty`||t.value===`dirty`?je(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?L:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?L:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Fe(e))return L;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Fe(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):L);N.assertNever(r)}};Vt.create=(e,t,n)=>new Vt({schema:e,typeName:V.ZodEffects,effect:t,...z(n)}),Vt.createWithPreprocess=(e,t,n)=>new Vt({schema:t,effect:{type:`preprocess`,transform:e},typeName:V.ZodEffects,...z(n)});var Ht=class extends B{_parse(e){return this._getType(e)===P.undefined?Me(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ht.create=(e,t)=>new Ht({innerType:e,typeName:V.ZodOptional,...z(t)});var Ut=class extends B{_parse(e){return this._getType(e)===P.null?Me(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ut.create=(e,t)=>new Ut({innerType:e,typeName:V.ZodNullable,...z(t)});var Wt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Wt.create=(e,t)=>new Wt({innerType:e,typeName:V.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...z(t)});var Gt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ie(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:V.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...z(t)});var Kt=class extends B{_parse(e){if(this._getType(e)!==P.nan){let t=this._getOrReturnCtx(e);return I(t,{code:F.invalid_type,expected:P.nan,received:t.parsedType}),L}return{status:`valid`,value:e.data}}};Kt.create=e=>new Kt({typeName:V.ZodNaN,...z(e)});var qt=class extends B{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Jt=class e extends B{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?L:e.status===`dirty`?(t.dirty(),je(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?L:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:V.ZodPipeline})}},Yt=class extends B{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Fe(e)&&(e.value=Object.freeze(e.value)),e);return Ie(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Yt.create=(e,t)=>new Yt({innerType:e,typeName:V.ZodReadonly,...z(t)}),wt.lazycreate;var V;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(V||={});var H=lt.create,U=dt.create;Kt.create,ft.create;var Xt=pt.create;mt.create,ht.create;var Zt=gt.create,W=_t.create,Qt=vt.create,$t=yt.create;bt.create;var en=xt.create,G=St.create,K=wt.create;wt.strictCreate;var q=Tt.create,tn=Dt.create;kt.create,At.create;var nn=jt.create;Mt.create,Nt.create,Pt.create,Ft.create;var J=It.create,Y=Rt.create;zt.create,Bt.create,Vt.create;var rn=Ht.create;Ut.create,Vt.createWithPreprocess,Jt.create;var an=K({id:H(),name:H(),address:H(),currency:H(),balance:H(),spendableBalance:H(),blockHeight:q([U(),Zt()]),lastSyncDate:H(),parentAccountId:H().optional()}),on=Y([`CryptoCurrency`,`TokenCurrency`]),sn=Y([`ERC20`]),cn=K({color:H(),ticker:H(),id:H(),name:H(),decimals:U()}),ln=tn(`type`,[cn.extend({type:J(on.enum.CryptoCurrency),family:H()}),cn.extend({type:J(on.enum.TokenCurrency),parent:H()}).extend({standard:sn,contract:H()})]),X=K({amount:H(),recipient:H()}),Z=Y(`algorand.aptos.bitcoin.cardano.casper.celo.crypto_org.cosmos.elrond.ethereum.filecoin.hedera.internet_computer.kaspa.near.neo.polkadot.ripple.solana.stacks.stellar.sui.tezos.ton.tron.vechain`.split(`.`)),un=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:a.toString(),recipient:o,fees:n?n.toString():void 0,memo:i,mode:t,assetId:r}),dn=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:new M(a),recipient:o,fees:n?new M(n):void 0,memo:i,mode:t,assetId:r}),fn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),pn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new M(r),recipient:i,fees:n?new M(n):void 0,mode:t});u();function mn({family:e,amount:t,recipient:n,feePerByte:r,opReturnData:i,changeAddress:a}){return{family:e,amount:t.toString(),recipient:n,feePerByte:r?.toString(),opReturnDataHex:i?.toString(`hex`),changeAddress:a}}function hn({family:e,amount:t,recipient:n,feePerByte:r,opReturnDataHex:i,changeAddress:a}){return{family:e,amount:new M(t),recipient:n,feePerByte:r?new M(r):void 0,opReturnData:i?d.from(i,`hex`):void 0,changeAddress:a}}function gn({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,index:r,mode:i,recipient:a}}function _n({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:new M(e),family:t,fees:n?new M(n):void 0,index:r,mode:i,recipient:a}}var vn=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gas:a?a.toString():void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:e.amount.toString()})):void 0}),yn=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0,gas:a?new M(a):void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:new M(e.amount)})):void 0}),bn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),xn=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new M(r),recipient:i,fees:n?new M(n):void 0,mode:t});u();function Sn({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:t.toString(),recipient:n,nonce:r,data:i?i.toString(`hex`):void 0,gasPrice:a?a.toString():void 0,gasLimit:o?o.toString():void 0,maxPriorityFeePerGas:s?s.toString():void 0,maxFeePerGas:c?c.toString():void 0,sponsored:l}}function Cn({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:new M(t),recipient:n,nonce:r,data:i?d.from(i,`hex`):void 0,gasPrice:a?new M(a):void 0,gasLimit:o?new M(o):void 0,maxPriorityFeePerGas:s?new M(s):void 0,maxFeePerGas:c?new M(c):void 0,sponsored:l}}function wn({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function Tn({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0}}function En({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:e.toString(),family:t,memo:n,recipient:r}}function Dn({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:new M(e),family:t,memo:n,recipient:r}}function On({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:t.toString(),recipient:n,customFeeRate:r?.toString()}}function kn({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:new M(t),recipient:n,customFeeRate:r?new M(r):void 0}}u();function An({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:e.toString(),data:t?t.toString(`hex`):void 0,family:n,gasLimit:o.toNumber(),gasFeeCap:s.toString(),gasPremium:c.toString(),method:r,nonce:i,params:a,recipient:l,version:u}}function jn({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:new M(e),data:t?d.from(t,`hex`):void 0,family:n,gasLimit:new M(o),gasFeeCap:new M(s),gasPremium:new M(c),nonce:i,method:r,params:a,recipient:l,version:u}}function Mn({amount:e,recipient:t,family:n}){return{amount:e.toString(),recipient:t,family:n}}function Nn({amount:e,recipient:t,family:n}){return{amount:new M(e),recipient:t,family:n}}var Pn=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fee:i?i.toString():void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),Fn=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:new M(e),recipient:t,family:n,mode:r,fee:i?new M(i):void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),In=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fee:t?t.toString():void 0,tag:n}),Ln=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:new M(r),recipient:i,fee:t?new M(t):void 0,tag:n}),Rn=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:e.toString(),recipient:t,family:n,fees:r?r.toString():void 0,memoType:i,memoValue:a}),zn=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:new M(e),recipient:t,family:n,fees:r?new M(r):void 0,memoType:i,memoValue:a}),Bn=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gasLimit:a?a.toString():void 0}),Vn=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0,gasLimit:a?new M(a):void 0}),Hn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.inspectSymbol=void 0,e.inspectSymbol=Symbol.for(`nodejs.util.inspect.custom`)})),Un=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.crc16=void 0;function t(e){let t=0,n=d.alloc(e.length+2);n.set(e);for(let e of n){let n=128;for(;n>0;)t<<=1,e&n&&(t+=1),n>>=1,t>65535&&(t&=65535,t^=4129)}return d.from([Math.floor(t/256),t%256])}e.crc16=t})),Wn=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.address=e.Address=void 0;var n=Hn(),r=Un(),i=17,a=81,o=128;function s(e){if(typeof e==`string`&&!c.isFriendly(e))throw Error(`Unknown address type`);let t=d.isBuffer(e)?e:d.from(e,`base64`);if(t.length!==36)throw Error(`Unknown address type: byte length is not equal to 36`);let n=t.subarray(0,34),s=t.subarray(34,36),l=(0,r.crc16)(n);if(!(l[0]===s[0]&&l[1]===s[1]))throw Error(`Invalid checksum: `+e);let u=n[0],f=!1,p=!1;if(u&o&&(f=!0,u^=o),u!==i&&u!==a)throw`Unknown address tag`;p=u===i;let m=null;m=n[1]===255?-1:n[1];let h=n.subarray(2,34);return{isTestOnly:f,isBounceable:p,workchain:m,hashPart:h}}var c=class e{static isAddress(t){return t instanceof e}static isFriendly(e){return!(e.length!==48||!/^[A-Za-z0-9+/_-]+$/.test(e))}static isRaw(e){if(e.indexOf(`:`)===-1)return!1;let[t,n]=e.split(`:`);return!(!Number.isInteger(parseFloat(t))||!/[a-f0-9]+/.test(n.toLowerCase())||n.length!==64)}static normalize(t){return typeof t==`string`?e.parse(t).toString():t.toString()}static parse(t){if(e.isFriendly(t))return this.parseFriendly(t).address;if(e.isRaw(t))return this.parseRaw(t);throw Error(`Unknown address type: `+t)}static parseRaw(t){return new e(parseInt(t.split(`:`)[0]),d.from(t.split(`:`)[1],`hex`))}static parseFriendly(t){if(d.isBuffer(t)){let n=s(t);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}else{let n=s(t.replace(/\-/g,`+`).replace(/_/g,`/`));return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}}constructor(e,n){if(this.toRawString=()=>this.workChain+`:`+this.hash.toString(`hex`),this.toRaw=()=>{let e=d.alloc(36);return e.set(this.hash),e.set([this.workChain,this.workChain,this.workChain,this.workChain],32),e},this.toStringBuffer=e=>{let t=e&&e.testOnly!==void 0?e.testOnly:!1,n=!(e&&e.bounceable!==void 0)||e.bounceable?i:a;t&&(n|=o);let s=d.alloc(34);s[0]=n,s[1]=this.workChain,s.set(this.hash,2);let c=d.alloc(36);return c.set(s),c.set((0,r.crc16)(s),34),c},this.toString=e=>{let t=e&&e.urlSafe!==void 0?e.urlSafe:!0,n=this.toStringBuffer(e);return t?n.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`):n.toString(`base64`)},this[t]=()=>this.toString(),n.length!==32)throw Error(`Invalid address hash length: `+n.length);this.workChain=e,this.hash=n,Object.freeze(this)}equals(e){return e.workChain===this.workChain?e.hash.equals(this.hash):!1}};e.Address=c,t=n.inspectSymbol;function l(e){return c.parse(e)}e.address=l})),Gn=e((e=>{var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.ExternalAddress=void 0;var n=Hn();e.ExternalAddress=class e{static isAddress(t){return t instanceof e}constructor(e,n){this[t]=()=>this.toString(),this.value=e,this.bits=n}toString(){return`External<${this.bits}:${this.value}>`}},t=n.inspectSymbol})),Kn=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.base32Decode=e.base32Encode=void 0;var t=`abcdefghijklmnopqrstuvwxyz234567`;function n(e){let n=e.byteLength,r=0,i=0,a=``;for(let o=0;o<n;o++)for(i=i<<8|e[o],r+=8;r>=5;)a+=t[i>>>r-5&31],r-=5;return r>0&&(a+=t[i<<5-r&31]),a}e.base32Encode=n;function r(e,t){let n=e.indexOf(t);if(n===-1)throw Error(`Invalid character found: `+t);return n}function i(e){let n;n=e.toLowerCase();let{length:i}=n,a=0,o=0,s=0,c=d.alloc(i*5/8|0);for(let e=0;e<i;e++)o=o<<5|r(t,n[e]),a+=5,a>=8&&(c[s++]=o>>>a-8&255,a-=8);return c}e.base32Decode=i})),qn=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.ADNLAddress=void 0;var n=Hn(),r=Kn(),i=Un();e.ADNLAddress=class e{static parseFriendly(t){if(t.length!==55)throw Error(`Invalid address`);t=`f`+t;let n=(0,r.base32Decode)(t);if(n[0]!==45)throw Error(`Invalid address`);let a=n.slice(33);if(!(0,i.crc16)(n.slice(0,33)).equals(a))throw Error(`Invalid address`);return new e(n.slice(1,33))}static parseRaw(t){return new e(d.from(t,`base64`))}constructor(e){if(this.toRaw=()=>this.address.toString(`hex`).toUpperCase(),this.toString=()=>{let e=d.concat([d.from([45]),this.address]),t=(0,i.crc16)(e);return e=d.concat([e,t]),(0,r.base32Encode)(e).slice(1)},this[t]=()=>this.toString(),e.length!==32)throw Error(`Invalid address`);this.address=e}equals(e){return this.address.equals(e.address)}},t=n.inspectSymbol})),Jn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.paddedBufferToBits=e.bitsToPaddedBuffer=void 0;var t=Xn(),n=Yn();function r(e){let n=new t.BitBuilder(Math.ceil(e.length/8)*8);n.writeBits(e);let r=Math.ceil(e.length/8)*8-e.length;for(let e=0;e<r;e++)e===0?n.writeBit(1):n.writeBit(0);return n.buffer()}e.bitsToPaddedBuffer=r;function i(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n]!==0){let r=e[n],i=r&-r;i&1||(i=Math.log2(i)+1),n>0&&(t=n<<3),t+=8-i;break}return new n.BitString(e,0,t)}e.paddedBufferToBits=i})),Yn=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.BitString=void 0;var n=Jn(),r=Hn(),i=class e{static isBitString(t){return t instanceof e}constructor(e,n,r){if(this[t]=()=>this.toString(),r<0)throw Error(`Length ${r} is out of bounds`);this._length=r,this._data=e,this._offset=n}get length(){return this._length}at(e){if(e>=this._length)throw Error(`Index ${e} > ${this._length} is out of bounds`);if(e<0)throw Error(`Index ${e} < 0 is out of bounds`);let t=this._offset+e>>3,n=7-(this._offset+e)%8;return(this._data[t]&1<<n)!=0}substring(t,n){if(t>this._length)throw Error(`Offset(${t}) > ${this._length} is out of bounds`);if(t<0)throw Error(`Offset(${t}) < 0 is out of bounds`);if(n===0)return e.EMPTY;if(t+n>this._length)throw Error(`Offset ${t} + Length ${n} > ${this._length} is out of bounds`);return new e(this._data,this._offset+t,n)}subbuffer(e,t){if(e>this._length||e<0)throw Error(`Offset ${e} is out of bounds`);if(e+t>this._length)throw Error(`Offset + Length = ${e+t} is out of bounds`);if(t%8!=0||(this._offset+e)%8!=0)return null;let n=this._offset+e>>3,r=n+(t>>3);return this._data.subarray(n,r)}equals(e){if(this._length!==e._length)return!1;for(let t=0;t<this._length;t++)if(this.at(t)!==e.at(t))return!1;return!0}toString(){let e=(0,n.bitsToPaddedBuffer)(this);if(this._length%4==0){let t=e.subarray(0,Math.ceil(this._length/8)).toString(`hex`).toUpperCase();return this._length%8==0?t:t.substring(0,t.length-1)}else{let t=e.toString(`hex`).toUpperCase();return this._length%8<=4?t.substring(0,t.length-1)+`_`:t+`_`}}};e.BitString=i,t=r.inspectSymbol,i.EMPTY=new i(d.alloc(0),0,0)})),Xn=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.BitBuilder=void 0;var t=Wn(),n=Gn(),r=Yn();e.BitBuilder=class{constructor(e=1023){this._buffer=d.alloc(Math.ceil(e/8)),this._length=0}get length(){return this._length}writeBit(e){let t=this._length;if(t>this._buffer.length*8)throw Error(`BitBuilder overflow`);(typeof e==`boolean`&&e===!0||typeof e==`number`&&e>0)&&(this._buffer[t/8|0]|=1<<7-t%8),this._length++}writeBits(e){for(let t=0;t<e.length;t++)this.writeBit(e.at(t))}writeBuffer(e){if(this._length%8==0){if(this._length+e.length*8>this._buffer.length*8)throw Error(`BitBuilder overflow`);e.copy(this._buffer,this._length/8),this._length+=e.length*8}else for(let t=0;t<e.length;t++)this.writeUint(e[t],8)}writeUint(e,t){if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);let n=BigInt(e);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}let r=1n<<BigInt(t);if(n<0||n>=r)throw Error(`bitLength is too small for a value ${e}. Got ${t}`);if(this._length+t>this._buffer.length*8)throw Error(`BitBuilder overflow`);let i=8-this._length%8;if(i>0){let e=Math.floor(this._length/8);if(t<i){let r=Number(n);this._buffer[e]|=r<<i-t,this._length+=t}else{let r=Number(n>>BigInt(t-i));this._buffer[e]|=r,this._length+=i}}for(t-=i;t>0;)t>=8?(this._buffer[this._length/8]=Number(n>>BigInt(t-8)&255n),this._length+=8,t-=8):(this._buffer[this._length/8]=Number(n<<BigInt(8-t)&255n),this._length+=t,t=0)}writeInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}if(t===1){if(n!==-1n&&n!==0n)throw Error(`value is not zero or -1 for ${t} bits. Got ${e}`);this.writeBit(n===-1n);return}let r=1n<<BigInt(t)-1n;if(n<-r||n>=r)throw Error(`value is out of range for ${t} bits. Got ${e}`);n<0?(this.writeBit(!0),n=r+n):this.writeBit(!1),this.writeUint(n,t-1)}writeVarUint(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n<0)throw Error(`value is negative. Got ${e}`);if(n===0n){this.writeUint(0,t);return}let r=Math.ceil(n.toString(2).length/8),i=r*8;this.writeUint(r,t),this.writeUint(n,i)}writeVarInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n===0n){this.writeUint(0,t);return}let r=n>0?n:-n,i=Math.ceil((r.toString(2).length+1)/8),a=i*8;this.writeUint(i,t),this.writeInt(n,a)}writeCoins(e){this.writeVarUint(e,4)}writeAddress(e){if(e==null){this.writeUint(0,2);return}if(t.Address.isAddress(e)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(e.workChain,8),this.writeBuffer(e.hash);return}if(n.ExternalAddress.isAddress(e)){this.writeUint(1,2),this.writeUint(e.bits,9),this.writeUint(e.value,e.bits);return}throw Error(`Invalid address. Got ${e}`)}build(){return new r.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!=0)throw Error(`BitBuilder buffer is not byte aligned`);return this._buffer.subarray(0,this._length/8)}}})),Zn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CellType=void 0;var t;(function(e){e[e.Ordinary=-1]=`Ordinary`,e[e.PrunedBranch=1]=`PrunedBranch`,e[e.Library=2]=`Library`,e[e.MerkleProof=3]=`MerkleProof`,e[e.MerkleUpdate=4]=`MerkleUpdate`})(t||(e.CellType=t={}))})),Qn=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readUnaryLength=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}e.readUnaryLength=t})),$n=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.BitReader=void 0;var t=Wn(),n=Gn();e.BitReader=class e{constructor(e,t=0){this._checkpoints=[],this._bits=e,this._offset=t}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(e){if(e<0||this._offset+e>this._bits.length)throw Error(`Index ${this._offset+e} is out of bounds`);this._offset+=e}reset(){this._checkpoints.length>0?this._offset=this._checkpoints.pop():this._offset=0}save(){this._checkpoints.push(this._offset)}loadBit(){let e=this._bits.at(this._offset);return this._offset++,e}preloadBit(){return this._bits.at(this._offset)}loadBits(e){let t=this._bits.substring(this._offset,e);return this._offset+=e,t}preloadBits(e){return this._bits.substring(this._offset,e)}loadBuffer(e){let t=this._preloadBuffer(e,this._offset);return this._offset+=e*8,t}preloadBuffer(e){return this._preloadBuffer(e,this._offset)}loadUint(e){return this._toSafeInteger(this.loadUintBig(e),`loadUintBig`)}loadUintBig(e){let t=this.preloadUintBig(e);return this._offset+=e,t}preloadUint(e){return this._toSafeInteger(this._preloadUint(e,this._offset),`preloadUintBig`)}preloadUintBig(e){return this._preloadUint(e,this._offset)}loadInt(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,this._toSafeInteger(t,`loadUintBig`)}loadIntBig(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,t}preloadInt(e){return this._toSafeInteger(this._preloadInt(e,this._offset),`preloadIntBig`)}preloadIntBig(e){return this._preloadInt(e,this._offset)}loadVarUint(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadUintBig(t*8),`loadVarUintBig`)}loadVarUintBig(e){let t=Number(this.loadUint(e));return this.loadUintBig(t*8)}preloadVarUint(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadUint(t*8,this._offset+e),`preloadVarUintBig`)}preloadVarUintBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadUint(t*8,this._offset+e)}loadVarInt(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadIntBig(t*8),`loadVarIntBig`)}loadVarIntBig(e){let t=Number(this.loadUint(e));return this.loadIntBig(t*8)}preloadVarInt(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadInt(t*8,this._offset+e),`preloadVarIntBig`)}preloadVarIntBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadInt(t*8,this._offset+e)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===2)return this._loadInternalAddress();throw Error(`Invalid address: `+e)}loadMaybeAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();throw Error(`Invalid address`)}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadMaybeExternalAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadAddressAny(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();if(e===1)return this._loadExternalAddress();throw Error(e===3?`Unsupported`:`Unreachable`)}loadPaddedBits(e){if(e%8!=0)throw Error(`Invalid number of bits`);let t=e;for(;;)if(this._bits.at(this._offset+t-1)){t--;break}else t--;let n=this._bits.substring(this._offset,t);return this._offset+=e,n}clone(){return new e(this._bits,this._offset)}_preloadInt(e,t){if(e==0)return 0n;let n=this._bits.at(t),r=0n;for(let n=0;n<e-1;n++)this._bits.at(t+1+n)&&(r+=1n<<BigInt(e-n-1-1));return n&&(r-=1n<<BigInt(e-1)),r}_preloadUint(e,t){if(e==0)return 0n;let n=0n;for(let r=0;r<e;r++)this._bits.at(t+r)&&(n+=1n<<BigInt(e-r-1));return n}_preloadBuffer(e,t){let n=this._bits.subbuffer(t,e*8);if(n)return n;let r=d.alloc(e);for(let n=0;n<e;n++)r[n]=Number(this._preloadUint(8,t+n*8));return r}_loadInternalAddress(){if(Number(this._preloadUint(2,this._offset))!==2)throw Error(`Invalid address`);let e,n;this._preloadUint(1,this._offset+2)!==0n&&(n=Number(this._preloadUint(5,this._offset+3)),e=this._preloadUint(n,this._offset+8),this._offset+=5+n);let r=Number(this._preloadInt(8,this._offset+3)),i=this._preloadBuffer(32,this._offset+11);if(n!==void 0&&e!==void 0){let t=Number(e),r=0,a=0,o=n;for(;o>0;){let e=Math.min(8-a,o),n=(1<<e)-1<<8-a-e,s=(t>>o-e&(1<<e)-1)<<8-a-e;i[r]=i[r]&~n|s,o-=e,a+=e,a===8&&(r++,a=0)}}return this._offset+=267,new t.Address(r,i)}_loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))!==1)throw Error(`Invalid address`);let e=Number(this._preloadUint(9,this._offset+2)),t=this._preloadUint(e,this._offset+11);return this._offset+=11+e,new n.ExternalAddress(t,e)}_toSafeInteger(e,t){if(BigInt(2**53-1)<e||e<BigInt(-(2**53-1)))throw TypeError(`${e} is out of safe integer range. Use ${t} instead`);return Number(e)}}})),er=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertToMerkleProof=e.exoticMerkleProof=void 0;var t=$n(),n=Q();function r(e,n){let r=new t.BitReader(e);if(e.length!==280)throw Error(`Merkle Proof cell must have exactly (8 + 256 + 16) bits, got "${e.length}"`);if(n.length!==1)throw Error(`Merkle Proof cell must have exactly 1 ref, got "${n.length}"`);let i=r.loadUint(8);if(i!==3)throw Error(`Merkle Proof cell must have type 3, got "${i}"`);let a=r.loadBuffer(32),o=r.loadUint(16),s=n[0].hash(0),c=n[0].depth(0);if(o!==c)throw Error(`Merkle Proof cell ref depth must be exactly "${o}", got "${c}"`);if(!a.equals(s))throw Error(`Merkle Proof cell ref hash must be exactly "${a.toString(`hex`)}", got "${s.toString(`hex`)}"`);return{proofDepth:o,proofHash:a}}e.exoticMerkleProof=r;function i(e){return(0,n.beginCell)().storeUint(3,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).storeRef(e).endCell({exotic:!0})}e.convertToMerkleProof=i})),tr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.generateMerkleProof=e.generateMerkleProofDirect=void 0;var t=Q(),n=Qn(),r=er();function i(e){return(0,t.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).endCell({exotic:!0})}function a(e,r,o,s){let c=r.asCell();if(s.length==0)return i(c);let l=+!!r.loadBit(),u=0,d=e;if(l===0){u=(0,n.readUnaryLength)(r);for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let t=0;t<u;t++)d+=e}if(o-u===0)return c;{let e=c.beginParse(),n=e.loadRef(),r=e.loadRef();if(!n.isExotic){let e=s.filter(e=>d+`0`===e.slice(0,d.length+1));n=a(d+`0`,n.beginParse(),o-u-1,e)}if(!r.isExotic){let e=s.filter(e=>d+`1`===e.slice(0,d.length+1));r=a(d+`1`,r.beginParse(),o-u-1,e)}return(0,t.beginCell)().storeSlice(e).storeRef(n).storeRef(r).endCell()}}function o(e,n,r){return n.forEach(t=>{if(!e.has(t))throw Error(`Trying to generate merkle proof for a missing key "${t}"`)}),a(``,(0,t.beginCell)().storeDictDirect(e).asSlice(),r.bits,n.map(e=>r.serialize(e).toString(2).padStart(r.bits,`0`)))}e.generateMerkleProofDirect=o;function s(e,t,n){return(0,r.convertToMerkleProof)(o(e,t,n))}e.generateMerkleProof=s})),nr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.generateMerkleUpdate=void 0;var t=Q(),n=tr();function r(e,n){return(0,t.beginCell)().storeUint(4,8).storeBuffer(e.hash(0)).storeBuffer(n.hash(0)).storeUint(e.depth(0),16).storeUint(n.depth(0),16).storeRef(e).storeRef(n).endCell({exotic:!0})}function i(e,t,i,a){let o=(0,n.generateMerkleProof)(e,[t],i).refs[0];e.set(t,a);let s=(0,n.generateMerkleProof)(e,[t],i).refs[0];return r(o,s)}e.generateMerkleUpdate=i})),rr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseDict=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}function n(e,r,i,a,o){let s=+!!r.loadBit(),c=0,l=e;if(s===0){c=t(r);for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let t=0;t<c;t++)l+=e}if(i-c===0)a.set(BigInt(`0b`+l),o(r));else{let e=r.loadRef(),t=r.loadRef();e.isExotic||n(l+`0`,e.beginParse(),i-c-1,a,o),t.isExotic||n(l+`1`,t.beginParse(),i-c-1,a,o)}}function r(e,t,r){let i=new Map;return e&&n(``,e,t,i,r),i}e.parseDict=r})),ir=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.findCommonPrefix=void 0;function t(e,t=0){if(e.length===0)return``;let n=e[0].slice(t);for(let r=1;r<e.length;r++){let i=e[r];for(;i.indexOf(n,t)!==t;)if(n=n.substring(0,n.length-1),n===``)return n}return n}e.findCommonPrefix=t})),ar=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serializeDict=e.detectLabelType=e.writeLabelSame=e.writeLabelLong=e.writeLabelShort=e.buildTree=void 0;var t=Q(),n=ir();function r(e,t){for(;e.length<t;)e=`0`+e;return e}function i(e,t){if(e.size===0)throw Error(`Internal inconsistency`);let n=new Map,r=new Map;for(let[i,a]of e.entries())i[t]===`0`?n.set(i,a):r.set(i,a);if(n.size===0)throw Error(`Internal inconsistency. Left emtpy.`);if(r.size===0)throw Error(`Internal inconsistency. Right emtpy.`);return{left:n,right:r}}function a(e,t){if(e.size===0)throw Error(`Internal inconsistency`);if(e.size===1)return{type:`leaf`,value:Array.from(e.values())[0]};let{left:n,right:r}=i(e,t);return{type:`fork`,left:o(n,t+1),right:o(r,t+1)}}function o(e,t=0){if(e.size===0)throw Error(`Internal inconsistency`);let r=(0,n.findCommonPrefix)(Array.from(e.keys()),t);return{label:r,node:a(e,r.length+t)}}function s(e,t){let n=new Map;for(let i of Array.from(e.keys())){let a=r(i.toString(2),t);n.set(a,e.get(i))}return o(n)}e.buildTree=s;function c(e,t){t.storeBit(0);for(let n=0;n<e.length;n++)t.storeBit(1);return t.storeBit(0),e.length>0&&t.storeUint(BigInt(`0b`+e),e.length),t}e.writeLabelShort=c;function l(e){return 1+e.length+1+e.length}function u(e,t,n){n.storeBit(1),n.storeBit(0);let r=Math.ceil(Math.log2(t+1));return n.storeUint(e.length,r),e.length>0&&n.storeUint(BigInt(`0b`+e),e.length),n}e.writeLabelLong=u;function d(e,t){return 2+Math.ceil(Math.log2(t+1))+e.length}function f(e,t,n,r){r.storeBit(1),r.storeBit(1),r.storeBit(e);let i=Math.ceil(Math.log2(n+1));r.storeUint(t,i)}e.writeLabelSame=f;function p(e){return 3+Math.ceil(Math.log2(e+1))}function m(e){if(e.length===0||e.length===1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}function h(e,t){let n=`short`,r=l(e),i=d(e,t);if(i<r&&(r=i,n=`long`),m(e)){let e=p(t);e<r&&(r=e,n=`same`)}return n}e.detectLabelType=h;function g(e,t,n){let r=h(e,t);r===`short`?c(e,n):r===`long`?u(e,t,n):r===`same`&&f(e[0]===`1`,e.length,t,n)}function _(e,n,r,i){if(e.type===`leaf`&&r(e.value,i),e.type===`fork`){let a=(0,t.beginCell)(),o=(0,t.beginCell)();v(e.left,n-1,r,a),v(e.right,n-1,r,o),i.storeRef(a),i.storeRef(o)}}function v(e,t,n,r){g(e.label,t,r),_(e.node,t-e.label.length,n,r)}function y(e,t,n,r){v(s(e,t),t,n,r)}e.serializeDict=y})),or=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.deserializeInternalKey=e.serializeInternalKey=void 0;var t=Wn(),n=Yn(),r=Jn();function i(e){if(typeof e==`number`){if(!Number.isSafeInteger(e))throw Error(`Invalid key type: not a safe integer: `+e);return`n:`+e.toString(10)}else if(typeof e==`bigint`)return`b:`+e.toString(10);else if(t.Address.isAddress(e))return`a:`+e.toString();else if(d.isBuffer(e))return`f:`+e.toString(`hex`);else if(n.BitString.isBitString(e))return`B:`+e.toString();else throw Error(`Invalid key type`)}e.serializeInternalKey=i;function a(e){let i=e.slice(0,2),a=e.slice(2);if(i===`n:`)return parseInt(a,10);if(i===`b:`)return BigInt(a);if(i===`a:`)return t.Address.parse(a);if(i===`f:`)return d.from(a,`hex`);if(i===`B:`){let e=a.slice(-1)==`_`;if(e||a.length%2!=0){let t=e?a.length-1:a.length,i=a.substr(0,t)+`0`;return!e&&t&1?new n.BitString(d.from(i,`hex`),0,t<<2):(0,r.paddedBufferToBits)(d.from(i,`hex`))}else return new n.BitString(d.from(a,`hex`),0,a.length<<2)}throw Error(`Invalid key type: `+i)}e.deserializeInternalKey=a})),sr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.Dictionary=void 0;var t=Wn(),n=Q(),r=xr(),i=Yn(),a=tr(),o=nr(),s=rr(),c=ar(),l=or(),f=class e{static empty(t,n){return t&&n?new e(new Map,t,n):new e(new Map,null,null)}static load(t,n,i){let a;if(i instanceof r.Cell){if(i.isExotic)return e.empty(t,n);a=i.beginParse()}else a=i;let o=a.loadMaybeRef();return o&&!o.isExotic?e.loadDirect(t,n,o.beginParse()):e.empty(t,n)}static loadDirect(t,n,i){if(!i)return e.empty(t,n);let a;a=i instanceof r.Cell?i.beginParse():i;let o=(0,s.parseDict)(a,t.bits,n.parse),c=new Map;for(let[e,n]of o)c.set((0,l.serializeInternalKey)(t.parse(e)),n);return new e(c,t,n)}constructor(e,t,n){this._key=t,this._value=n,this._map=e}get size(){return this._map.size}get(e){return this._map.get((0,l.serializeInternalKey)(e))}has(e){return this._map.has((0,l.serializeInternalKey)(e))}set(e,t){return this._map.set((0,l.serializeInternalKey)(e),t),this}delete(e){let t=(0,l.serializeInternalKey)(e);return this._map.delete(t)}clear(){this._map.clear()}*[Symbol.iterator](){for(let[e,t]of this._map)yield[(0,l.deserializeInternalKey)(e),t]}keys(){return Array.from(this._map.keys()).map(e=>(0,l.deserializeInternalKey)(e))}values(){return Array.from(this._map.values())}store(e,t,r){if(this._map.size===0)e.storeBit(0);else{let i=this._key;t!=null&&(i=t);let a=this._value;if(r!=null&&(a=r),!i)throw Error(`Key serializer is not defined`);if(!a)throw Error(`Value serializer is not defined`);let o=new Map;for(let[e,t]of this._map)o.set(i.serialize((0,l.deserializeInternalKey)(e)),t);e.storeBit(1);let s=(0,n.beginCell)();(0,c.serializeDict)(o,i.bits,a.serialize,s),e.storeRef(s.endCell())}}storeDirect(e,t,n){if(this._map.size===0)throw Error(`Cannot store empty dictionary directly`);let r=this._key;t!=null&&(r=t);let i=this._value;if(n!=null&&(i=n),!r)throw Error(`Key serializer is not defined`);if(!i)throw Error(`Value serializer is not defined`);let a=new Map;for(let[e,t]of this._map)a.set(r.serialize((0,l.deserializeInternalKey)(e)),t);(0,c.serializeDict)(a,r.bits,i.serialize,e)}generateMerkleProof(e){return(0,a.generateMerkleProof)(this,e,this._key)}generateMerkleProofDirect(e){return(0,a.generateMerkleProofDirect)(this,e,this._key)}generateMerkleUpdate(e,t){return(0,o.generateMerkleUpdate)(this,e,this._key,t)}};e.Dictionary=f,f.Keys={Address:()=>p(),BigInt:e=>m(e),Int:e=>h(e),BigUint:e=>g(e),Uint:e=>_(e),Buffer:e=>v(e),BitString:e=>y(e)},f.Values={BigInt:e=>x(e),Int:e=>b(e),BigVarInt:e=>S(e),BigUint:e=>w(e),Uint:e=>ee(e),BigVarUint:e=>C(e),Bool:()=>te(),Address:()=>T(),Cell:()=>E(),Buffer:e=>ne(e),BitString:e=>re(e),Dictionary:(e,t)=>D(e,t)};function p(){return{bits:267,serialize:e=>{if(!t.Address.isAddress(e))throw Error(`Key is not an address`);return(0,n.beginCell)().storeAddress(e).endCell().beginParse().preloadUintBig(267)},parse:e=>(0,n.beginCell)().storeUint(e,267).endCell().beginParse().loadAddress()}}function m(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadIntBig(e)}}function h(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadInt(e)}}function g(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)}}function _(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>Number((0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUint(e))}}function v(e){return{bits:e*8,serialize:t=>{if(!d.isBuffer(t))throw Error(`Key is not a buffer`);return(0,n.beginCell)().storeBuffer(t).endCell().beginParse().loadUintBig(e*8)},parse:t=>(0,n.beginCell)().storeUint(t,e*8).endCell().beginParse().loadBuffer(e)}}function y(e){return{bits:e,serialize:t=>{if(!i.BitString.isBitString(t))throw Error(`Key is not a BitString`);return(0,n.beginCell)().storeBits(t).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadBits(e)}}function b(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadInt(e);return t.endParse(),n}}}function x(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadIntBig(e);return t.endParse(),n}}}function S(e){return{serialize:(t,n)=>{n.storeVarInt(t,e)},parse:t=>{let n=t.loadVarIntBig(e);return t.endParse(),n}}}function C(e){return{serialize:(t,n)=>{n.storeVarUint(t,e)},parse:t=>{let n=t.loadVarUintBig(e);return t.endParse(),n}}}function ee(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUint(e);return t.endParse(),n}}}function w(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUintBig(e);return t.endParse(),n}}}function te(){return{serialize:(e,t)=>{t.storeBit(e)},parse:e=>{let t=e.loadBit();return e.endParse(),t}}}function T(){return{serialize:(e,t)=>{t.storeAddress(e)},parse:e=>{let t=e.loadAddress();return e.endParse(),t}}}function E(){return{serialize:(e,t)=>{t.storeRef(e)},parse:e=>{let t=e.loadRef();return e.endParse(),t}}}function D(e,t){return{serialize:(e,t)=>{e.store(t)},parse:n=>{let r=f.load(e,t,n);return n.endParse(),r}}}function ne(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid buffer size`);n.storeBuffer(t)},parse:t=>{let n=t.loadBuffer(e);return t.endParse(),n}}}function re(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid BitString size`);n.storeBits(t)},parse:t=>{let n=t.loadBits(e);return t.endParse(),n}}}})),cr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.writeString=e.stringToCell=e.readString=void 0;var t=Q();function n(e){if(e.remainingBits%8!=0)throw Error(`Invalid string length: ${e.remainingBits}`);if(e.remainingRefs!==0&&e.remainingRefs!==1)throw Error(`invalid number of refs: ${e.remainingRefs}`);let t;return t=e.remainingBits===0?d.alloc(0):e.loadBuffer(e.remainingBits/8),e.remainingRefs===1&&(t=d.concat([t,n(e.loadRef().beginParse())])),t}function r(e){return n(e).toString()}e.readString=r;function i(e,n){if(e.length>0){let r=Math.floor(n.availableBits/8);if(e.length>r){let a=e.subarray(0,r),o=e.subarray(r);n=n.storeBuffer(a);let s=(0,t.beginCell)();i(o,s),n=n.storeRef(s.endCell())}else n=n.storeBuffer(e)}}function a(e){let n=(0,t.beginCell)();return i(d.from(e),n),n.endCell()}e.stringToCell=a;function o(e,t){i(d.from(e),t)}e.writeString=o})),lr=e((e=>{var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.Slice=void 0;var n=Hn(),r=sr(),i=Q(),a=cr();e.Slice=class e{constructor(e,n){this[t]=()=>this.toString(),this._reader=e.clone(),this._refs=[...n],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(e){return this._reader.skip(e),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(e){return this._reader.loadBits(e)}preloadBits(e){return this._reader.preloadBits(e)}loadUint(e){return this._reader.loadUint(e)}loadUintBig(e){return this._reader.loadUintBig(e)}preloadUint(e){return this._reader.preloadUint(e)}preloadUintBig(e){return this._reader.preloadUintBig(e)}loadMaybeUint(e){return this.loadBit()?this.loadUint(e):null}loadMaybeUintBig(e){return this.loadBit()?this.loadUintBig(e):null}loadInt(e){return this._reader.loadInt(e)}loadIntBig(e){return this._reader.loadIntBig(e)}preloadInt(e){return this._reader.preloadInt(e)}preloadIntBig(e){return this._reader.preloadIntBig(e)}loadMaybeInt(e){return this.loadBit()?this.loadInt(e):null}loadMaybeIntBig(e){return this.loadBit()?this.loadIntBig(e):null}loadVarUint(e){return this._reader.loadVarUint(e)}loadVarUintBig(e){return this._reader.loadVarUintBig(e)}preloadVarUint(e){return this._reader.preloadVarUint(e)}preloadVarUintBig(e){return this._reader.preloadVarUintBig(e)}loadVarInt(e){return this._reader.loadVarInt(e)}loadVarIntBig(e){return this._reader.loadVarIntBig(e)}preloadVarInt(e){return this._reader.preloadVarInt(e)}preloadVarIntBig(e){return this._reader.preloadVarIntBig(e)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(e){return this._reader.loadBuffer(e)}preloadBuffer(e){return this._reader.preloadBuffer(e)}loadStringTail(){return(0,a.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,a.readString)(this):null}loadStringRefTail(){return(0,a.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){let e=this.loadMaybeRef();return e?(0,a.readString)(e.beginParse()):null}loadDict(e,t){return r.Dictionary.load(e,t,this)}loadDictDirect(e,t){return r.Dictionary.loadDirect(e,t,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw Error(`Slice is not empty`)}asCell(){return(0,i.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,i.beginCell)().storeSlice(this)}clone(t=!1){if(t){let t=this._reader.clone();return t.reset(),new e(t,this._refs)}else{let t=new e(this._reader,this._refs);return t._refsOffset=this._refsOffset,t}}toString(){return this.asCell().toString()}},t=n.inspectSymbol})),ur=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.exoticLibrary=void 0;var t=$n();function n(e,n){let r=new t.BitReader(e);if(e.length!==264)throw Error(`Library cell must have exactly (8 + 256) bits, got "${e.length}"`);let i=r.loadUint(8);if(i!==2)throw Error(`Library cell must have type 2, got "${i}"`);return{}}e.exoticLibrary=n})),dr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.exoticMerkleUpdate=void 0;var t=$n();function n(e,n){let r=new t.BitReader(e);if(e.length!==552)throw Error(`Merkle Update cell must have exactly (8 + (2 * (256 + 16))) bits, got "${e.length}"`);if(n.length!==2)throw Error(`Merkle Update cell must have exactly 2 refs, got "${n.length}"`);let i=r.loadUint(8);if(i!==4)throw Error(`Merkle Update cell type must be exactly 4, got "${i}"`);let a=r.loadBuffer(32),o=r.loadBuffer(32),s=r.loadUint(16),c=r.loadUint(16);if(s!==n[0].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${s}", got "${n[0].depth(0)}"`);if(!a.equals(n[0].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${a.toString(`hex`)}", got "${n[0].hash(0).toString(`hex`)}"`);if(c!==n[1].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${c}", got "${n[1].depth(0)}"`);if(!o.equals(n[1].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${o.toString(`hex`)}", got "${n[1].hash(0).toString(`hex`)}"`);return{proofDepth1:s,proofDepth2:c,proofHash1:a,proofHash2:o}}e.exoticMerkleUpdate=n})),fr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LevelMask=void 0,e.LevelMask=class e{constructor(e=0){this._mask=0,this._mask=e,this._hashIndex=t(this._mask),this._hashCount=this._hashIndex+1}get value(){return this._mask}get level(){return 32-Math.clz32(this._mask)}get hashIndex(){return this._hashIndex}get hashCount(){return this._hashCount}apply(t){return new e(this._mask&(1<<t)-1)}isSignificant(e){return e===0||(this._mask>>e-1)%2!=0}};function t(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}})),pr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.exoticPruned=void 0;var t=$n(),n=fr();function r(e,r){let i=new t.BitReader(e),a=i.loadUint(8);if(a!==1)throw Error(`Pruned branch cell must have type 1, got "${a}"`);if(r.length!==0)throw Error(`Pruned Branch cell can't has refs, got "${r.length}"`);let o;if(e.length===280)o=new n.LevelMask(1);else{if(o=new n.LevelMask(i.loadUint(8)),o.level<1||o.level>3)throw Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${o.level}/${o.value}"`);let t=16+o.apply(o.level-1).hashCount*272;if(e.length!==t)throw Error(`Pruned branch cell must have exactly ${t} bits, got "${e.length}"`)}let s=[],c=[],l=[];for(let e=0;e<o.level;e++)c.push(i.loadBuffer(32));for(let e=0;e<o.level;e++)l.push(i.loadUint(16));for(let e=0;e<o.level;e++)s.push({depth:l[e],hash:c[e]});return{mask:o.value,pruned:s}}e.exoticPruned=r})),mr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveExotic=void 0;var t=$n(),n=Zn(),r=ur(),i=er(),a=dr(),o=pr(),s=fr();function c(e,t){let r=(0,o.exoticPruned)(e,t),i=[],a=[],c=new s.LevelMask(r.mask);for(let e=0;e<r.pruned.length;e++)i.push(r.pruned[e].depth),a.push(r.pruned[e].hash);return{type:n.CellType.PrunedBranch,depths:i,hashes:a,mask:c}}function l(e,t){(0,r.exoticLibrary)(e,t);let i=[],a=[],o=new s.LevelMask;return{type:n.CellType.Library,depths:i,hashes:a,mask:o}}function u(e,t){(0,i.exoticMerkleProof)(e,t);let r=[],a=[],o=new s.LevelMask(t[0].level()>>1);return{type:n.CellType.MerkleProof,depths:r,hashes:a,mask:o}}function d(e,t){(0,a.exoticMerkleUpdate)(e,t);let r=[],i=[],o=new s.LevelMask((t[0].level()|t[1].level())>>1);return{type:n.CellType.MerkleUpdate,depths:r,hashes:i,mask:o}}function f(e,n){let r=new t.BitReader(e).preloadUint(8);if(r===1)return c(e,n);if(r===2)return l(e,n);if(r===3)return u(e,n);if(r===4)return d(e,n);throw Error(`Invalid exotic cell type: `+r)}e.resolveExotic=f})),hr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.getRepr=e.getBitsDescriptor=e.getRefsDescriptor=void 0;var t=Zn(),n=Jn();function r(e,n,r){return e.length+(r===t.CellType.Ordinary?0:1)*8+n*32}e.getRefsDescriptor=r;function i(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}e.getBitsDescriptor=i;function a(e,a,o,s,c,l){let u=Math.ceil(a.length/8),f=d.alloc(2+u+34*o.length),p=0;f[p++]=r(o,c,l),f[p++]=i(e),(0,n.bitsToPaddedBuffer)(a).copy(f,p),p+=u;for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.depth(s+1):e.depth(s),f[p++]=Math.floor(n/256),f[p++]=n%256}for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.hash(s+1):e.hash(s),n.copy(f,p),p+=32}return f}e.getRepr=a})),gr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.wonderCalculator=void 0;var t=Yn(),n=Zn(),r=fr(),i=pr(),a=er(),o=hr(),s=ie(),c=dr(),l=ur();function u(e,u,d){let f,p=null;if(e===n.CellType.Ordinary){let e=0;for(let t of d)e|=t.mask.value;f=new r.LevelMask(e)}else if(e===n.CellType.PrunedBranch)p=(0,i.exoticPruned)(u,d),f=new r.LevelMask(p.mask);else if(e===n.CellType.MerkleProof)(0,a.exoticMerkleProof)(u,d),f=new r.LevelMask(d[0].mask.value>>1);else if(e===n.CellType.MerkleUpdate)(0,c.exoticMerkleUpdate)(u,d),f=new r.LevelMask((d[0].mask.value|d[1].mask.value)>>1);else if(e===n.CellType.Library)(0,l.exoticLibrary)(u,d),f=new r.LevelMask;else throw Error(`Unsupported exotic type`);let m=[],h=[],g=e===n.CellType.PrunedBranch?1:f.hashCount,_=f.hashCount-g;for(let r=0,i=0;r<=f.level;r++){if(!f.isSignificant(r))continue;if(i<_){i++;continue}let a;if(i===_){if(!(r===0||e===n.CellType.PrunedBranch))throw Error(`Invalid`);a=u}else{if(!(r!==0&&e!==n.CellType.PrunedBranch))throw Error(`Invalid: `+r+`, `+e);a=new t.BitString(h[i-_-1],0,256)}let c=0;for(let t of d){let i;i=e==n.CellType.MerkleProof||e==n.CellType.MerkleUpdate?t.depth(r+1):t.depth(r),c=Math.max(c,i)}d.length>0&&c++;let l=(0,o.getRepr)(u,a,d,r,f.apply(r).value,e),p=(0,s.sha256_sync)(l),g=i-_;m[g]=c,h[g]=p,i++}let v=[],y=[];if(p)for(let e=0;e<4;e++){let{hashIndex:t}=f.apply(e),{hashIndex:n}=f;t===n?(v.push(h[0]),y.push(m[0])):(v.push(p.pruned[t].hash),y.push(p.pruned[t].depth))}else for(let e=0;e<4;e++)v.push(h[f.apply(e).hashIndex]),y.push(m[f.apply(e).hashIndex]);return{mask:f,hashes:v,depths:y}}e.wonderCalculator=u})),_r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.topologicalSort=void 0;function t(e){let t=[e],n=new Map,r=new Set,i=[];for(;t.length>0;){let e=[...t];t=[];for(let i of e){let e=i.hash().toString(`hex`);if(!n.has(e)){r.add(e),n.set(e,{cell:i,refs:i.refs.map(e=>e.hash().toString(`hex`))});for(let e of i.refs)t.push(e)}}}let a=new Set;function o(e){if(!r.has(e))return;if(a.has(e))throw Error(`Not a DAG`);a.add(e);let t=n.get(e).refs;for(let e=t.length-1;e>=0;e--)o(t[e]);i.push(e),a.delete(e),r.delete(e)}for(;r.size>0;){let e=Array.from(r)[0];o(e)}let s=new Map;for(let e=0;e<i.length;e++)s.set(i[i.length-e-1],e);let c=[];for(let e=i.length-1;e>=0;e--){let t=i[e],r=n.get(t);c.push({cell:r.cell,refs:r.refs.map(e=>s.get(e))})}return c}e.topologicalSort=t})),vr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.bitsForNumber=void 0;function t(e,t){let n=BigInt(e);if(t===`int`)return n===0n||n===-1n?1:(n>0?n:-n).toString(2).length+1;if(t===`uint`){if(n<0)throw Error(`value is negative. Got ${e}`);return n.toString(2).length}else throw Error(`invalid mode. Got ${t}`)}e.bitsForNumber=t})),yr=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.crc32c=void 0;var t=2197175160;function n(e){let n=-1;for(let r=0;r<e.length;r++)n^=e[r],n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1;n^=4294967295;let r=d.alloc(4);return r.writeInt32LE(n),r}e.crc32c=n})),br=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serializeBoc=e.deserializeBoc=e.parseBoc=void 0;var t=$n(),n=Yn(),r=xr(),i=_r(),a=vr(),o=Xn(),s=hr(),c=Jn(),l=yr();function u(e){return d(e&7)}function d(e){let t=0;for(let n=0;n<3;n++)t+=e&1,e>>=1;return t+1}function f(e,t){let r=e.loadUint(8),i=r%8,a=!!(r&8),o=e.loadUint(8),s=Math.ceil(o/2),c=!!(o%2),l=r>>5,d=(r&16)!=0,f=d?u(l)*32:0,p=d?u(l)*2:0;e.skip(f*8),e.skip(p*8);let m=n.BitString.EMPTY;s>0&&(m=c?e.loadPaddedBits(s*8):e.loadBits(s*8));let h=[];for(let n=0;n<i;n++)h.push(e.loadUint(t*8));return{bits:m,refs:h,exotic:a}}function p(e,t){return 2+Math.ceil(e.bits.length/8)+e.refs.length*t}function m(e){let r=new t.BitReader(new n.BitString(e,0,e.length*8)),i=r.loadUint(32);if(i===1761568243){let e=r.loadUint(8),t=r.loadUint(8),n=r.loadUint(e*8),i=r.loadUint(e*8),a=r.loadUint(e*8),o=r.loadUint(t*8);return{size:e,offBytes:t,cells:n,roots:i,absent:a,totalCellSize:o,index:r.loadBuffer(n*t),cellData:r.loadBuffer(o),root:[0]}}else if(i===2898503464){let t=r.loadUint(8),n=r.loadUint(8),i=r.loadUint(t*8),a=r.loadUint(t*8),o=r.loadUint(t*8),s=r.loadUint(n*8),c=r.loadBuffer(i*n),u=r.loadBuffer(s),d=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(d))throw Error(`Invalid CRC32C`);return{size:t,offBytes:n,cells:i,roots:a,absent:o,totalCellSize:s,index:c,cellData:u,root:[0]}}else if(i===3052313714){let t=r.loadUint(1),n=r.loadUint(1);r.loadUint(1),r.loadUint(2);let i=r.loadUint(3),a=r.loadUint(8),o=r.loadUint(i*8),s=r.loadUint(i*8),c=r.loadUint(i*8),u=r.loadUint(a*8),d=[];for(let e=0;e<s;e++)d.push(r.loadUint(i*8));let f=null;t&&(f=r.loadBuffer(o*a));let p=r.loadBuffer(u);if(n){let t=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(t))throw Error(`Invalid CRC32C`)}return{size:i,offBytes:a,cells:o,roots:s,absent:c,totalCellSize:u,index:f,cellData:p,root:d}}else throw Error(`Invalid magic`)}e.parseBoc=m;function h(e){let i=m(e),a=new t.BitReader(new n.BitString(i.cellData,0,i.cellData.length*8)),o=[];for(let e=0;e<i.cells;e++){let e=f(a,i.size);o.push({...e,result:null})}for(let e=o.length-1;e>=0;e--){if(o[e].result)throw Error(`Impossible`);let t=[];for(let n of o[e].refs){if(!o[n].result)throw Error(`Invalid BOC file`);t.push(o[n].result)}o[e].result=new r.Cell({bits:o[e].bits,refs:t,exotic:o[e].exotic})}let s=[];for(let e=0;e<i.root.length;e++)s.push(o[i.root[e]].result);return s}e.deserializeBoc=h;function g(e,t,n,r){let i=(0,s.getRefsDescriptor)(e.refs,e.mask.value,e.type),a=(0,s.getBitsDescriptor)(e.bits);r.writeUint(i,8),r.writeUint(a,8),r.writeBuffer((0,c.bitsToPaddedBuffer)(e.bits));for(let e of t)r.writeUint(e,n*8)}function _(e,t){let n=(0,i.topologicalSort)(e),r=n.length,s=t.idx,c=t.crc32,u=Math.max(Math.ceil((0,a.bitsForNumber)(r,`uint`)/8),1),d=0,f=[];for(let e of n){let t=p(e.cell,u);d+=t,f.push(d)}let m=Math.max(Math.ceil((0,a.bitsForNumber)(d,`uint`)/8),1),h=(6+3*u+m+1*u+(s?r*m:0)+d+(c?4:0))*8,_=new o.BitBuilder(h);if(_.writeUint(3052313714,32),_.writeBit(s),_.writeBit(c),_.writeBit(!1),_.writeUint(0,2),_.writeUint(u,3),_.writeUint(m,8),_.writeUint(r,u*8),_.writeUint(1,u*8),_.writeUint(0,u*8),_.writeUint(d,m*8),_.writeUint(0,u*8),s)for(let e=0;e<r;e++)_.writeUint(f[e],m*8);for(let e=0;e<r;e++)g(n[e].cell,n[e].refs,u,_);if(c){let e=(0,l.crc32c)(_.buffer());_.writeBuffer(e)}let v=_.buffer();if(v.length!==h/8)throw Error(`Internal error`);return v}e.serializeBoc=_})),xr=e((e=>{u();var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.Cell=void 0;var n=Hn(),r=Yn(),i=Zn(),a=lr(),o=mr(),s=gr(),c=br(),l=$n(),f=Q(),p=class e{static fromBoc(e){return(0,c.deserializeBoc)(e)}static fromBase64(t){let n=e.fromBoc(d.from(t,`base64`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}static fromHex(t){let n=e.fromBoc(d.from(t,`hex`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}constructor(e){this._hashes=[],this._depths=[],this.beginParse=(e=!1)=>{if(this.isExotic&&!e)throw Error(`Exotic cells cannot be parsed`);return new a.Slice(new l.BitReader(this.bits),this.refs)},this.hash=(e=3)=>this._hashes[Math.min(this._hashes.length-1,e)],this.depth=(e=3)=>this._depths[Math.min(this._depths.length-1,e)],this.level=()=>this.mask.level,this.equals=e=>this.hash().equals(e.hash()),this[t]=()=>this.toString();let n=r.BitString.EMPTY;e&&e.bits&&(n=e.bits);let c=[];e&&e.refs&&(c=[...e.refs]);let u,d,f,p=i.CellType.Ordinary;if(e&&e.exotic){let e=(0,o.resolveExotic)(n,c),t=(0,s.wonderCalculator)(e.type,n,c);f=t.mask,d=t.depths,u=t.hashes,p=e.type}else{if(c.length>4)throw Error(`Invalid number of references`);if(n.length>1023)throw Error(`Bits overflow: ${n.length} > 1023`);let e=(0,s.wonderCalculator)(i.CellType.Ordinary,n,c);f=e.mask,d=e.depths,u=e.hashes,p=i.CellType.Ordinary}this.type=p,this.bits=n,this.refs=c,this.mask=f,this._depths=d,this._hashes=u,Object.freeze(this),Object.freeze(this.refs),Object.freeze(this.bits),Object.freeze(this.mask),Object.freeze(this._depths),Object.freeze(this._hashes)}get isExotic(){return this.type!==i.CellType.Ordinary}toBoc(e){let t=e&&e.idx!==null&&e.idx!==void 0?e.idx:!1,n=e&&e.crc32!==null&&e.crc32!==void 0?e.crc32:!0;return(0,c.serializeBoc)(this,{idx:t,crc32:n})}toString(e){let t=e||``,n=`x`;this.isExotic&&(this.type===i.CellType.MerkleProof?n=`p`:this.type===i.CellType.MerkleUpdate?n=`u`:this.type===i.CellType.PrunedBranch&&(n=`p`));let r=t+(this.isExotic?n:`x`)+`{`+this.bits.toString()+`}`;for(let e in this.refs){let n=this.refs[e];r+=`
2
2
  `+n.toString(t+` `)}return r}asSlice(){return this.beginParse()}asBuilder(){return(0,f.beginCell)().storeSlice(this.asSlice())}};e.Cell=p,t=n.inspectSymbol,p.EMPTY=new p})),Q=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Builder=e.beginCell=void 0;var t=Xn(),n=xr(),r=cr();function i(){return new a}e.beginCell=i;var a=class e{constructor(){this._bits=new t.BitBuilder,this._refs=[]}get bits(){return this._bits.length}get refs(){return this._refs.length}get availableBits(){return 1023-this.bits}get availableRefs(){return 4-this.refs}storeBit(e){return this._bits.writeBit(e),this}storeBits(e){return this._bits.writeBits(e),this}storeBuffer(e,t){if(t!=null&&e.length!==t)throw Error(`Buffer length ${e.length} is not equal to ${t}`);return this._bits.writeBuffer(e),this}storeMaybeBuffer(e,t){return e===null?this.storeBit(0):(this.storeBit(1),this.storeBuffer(e,t)),this}storeUint(e,t){return this._bits.writeUint(e,t),this}storeMaybeUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeUint(e,t)),this}storeInt(e,t){return this._bits.writeInt(e,t),this}storeMaybeInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeInt(e,t)),this}storeVarUint(e,t){return this._bits.writeVarUint(e,t),this}storeMaybeVarUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarUint(e,t)),this}storeVarInt(e,t){return this._bits.writeVarInt(e,t),this}storeMaybeVarInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarInt(e,t)),this}storeCoins(e){return this._bits.writeCoins(e),this}storeMaybeCoins(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeCoins(e)),this}storeAddress(e){return this._bits.writeAddress(e),this}storeRef(t){if(this._refs.length>=4)throw Error(`Too many references`);if(t instanceof n.Cell)this._refs.push(t);else if(t instanceof e)this._refs.push(t.endCell());else throw Error(`Invalid argument`);return this}storeMaybeRef(e){return e?(this.storeBit(1),this.storeRef(e)):this.storeBit(0),this}storeSlice(e){let t=e.clone();for(t.remainingBits>0&&this.storeBits(t.loadBits(t.remainingBits));t.remainingRefs>0;)this.storeRef(t.loadRef());return this}storeMaybeSlice(e){return e?(this.storeBit(1),this.storeSlice(e)):this.storeBit(0),this}storeBuilder(e){return this.storeSlice(e.endCell().beginParse())}storeMaybeBuilder(e){return e?(this.storeBit(1),this.storeBuilder(e)):this.storeBit(0),this}storeWritable(e){return typeof e==`object`?e.writeTo(this):e(this),this}storeMaybeWritable(e){return e?(this.storeBit(1),this.storeWritable(e)):this.storeBit(0),this}store(e){return this.storeWritable(e),this}storeStringTail(e){return(0,r.writeString)(e,this),this}storeMaybeStringTail(e){return e==null?this.storeBit(0):(this.storeBit(1),(0,r.writeString)(e,this)),this}storeStringRefTail(e){return this.storeRef(i().storeStringTail(e)),this}storeMaybeStringRefTail(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeStringRefTail(e)),this}storeDict(e,t,n){return e?e.store(this,t,n):this.storeBit(0),this}storeDictDirect(e,t,n){return e.storeDirect(this,t,n),this}endCell(e){return new n.Cell({bits:this._bits.build(),refs:this._refs,exotic:e?.exotic})}asCell(){return this.endCell()}asSlice(){return this.endCell().beginParse()}};e.Builder=a})),Sr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SimpleLibraryValue=e.storeSimpleLibrary=e.loadSimpleLibrary=void 0;function t(e){return{public:e.loadBit(),root:e.loadRef()}}e.loadSimpleLibrary=t;function n(e){return t=>{t.storeBit(e.public),t.storeRef(e.root)}}e.storeSimpleLibrary=n,e.SimpleLibraryValue={serialize(e,t){n(e)(t)},parse(e){return t(e)}}})),Cr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTickTock=e.loadTickTock=void 0;function t(e){return{tick:e.loadBit(),tock:e.loadBit()}}e.loadTickTock=t;function n(e){return t=>{t.storeBit(e.tick),t.storeBit(e.tock)}}e.storeTickTock=n})),wr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeStateInit=e.loadStateInit=void 0;var t=sr(),n=Sr(),r=Cr();function i(e){let i;e.loadBit()&&(i=e.loadUint(5));let a;e.loadBit()&&(a=(0,r.loadTickTock)(e));let o=e.loadMaybeRef(),s=e.loadMaybeRef(),c=e.loadDict(t.Dictionary.Keys.BigUint(256),n.SimpleLibraryValue);return c.size===0&&(c=void 0),{splitDepth:i,special:a,code:o,data:s,libraries:c}}e.loadStateInit=i;function a(e){return t=>{e.splitDepth!==null&&e.splitDepth!==void 0?(t.storeBit(!0),t.storeUint(e.splitDepth,5)):t.storeBit(!1),e.special!==null&&e.special!==void 0?(t.storeBit(!0),t.store((0,r.storeTickTock)(e.special))):t.storeBit(!1),t.storeMaybeRef(e.code),t.storeMaybeRef(e.data),t.storeDict(e.libraries)}}e.storeStateInit=a})),Tr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contractAddress=void 0;var t=Q(),n=wr(),r=Wn();function i(e,i){let a=(0,t.beginCell)().store((0,n.storeStateInit)(i)).endCell().hash();return new r.Address(e,a)}e.contractAddress=i})),Er=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseTuple=e.serializeTuple=e.parseTupleItem=e.serializeTupleItem=void 0;var t=Q(),n=BigInt(`-9223372036854775808`),r=BigInt(`9223372036854775807`);function i(e,a){if(e.type===`null`)a.storeUint(0,8);else if(e.type===`int`)e.value<=r&&e.value>=n?(a.storeUint(1,8),a.storeInt(e.value,64)):(a.storeUint(256,15),a.storeInt(e.value,257));else if(e.type===`nan`)a.storeInt(767,16);else if(e.type===`cell`)a.storeUint(3,8),a.storeRef(e.cell);else if(e.type===`slice`)a.storeUint(4,8),a.storeUint(0,10),a.storeUint(e.cell.bits.length,10),a.storeUint(0,3),a.storeUint(e.cell.refs.length,3),a.storeRef(e.cell);else if(e.type===`builder`)a.storeUint(5,8),a.storeRef(e.cell);else if(e.type===`tuple`){let n=null,r=null;for(let a=0;a<e.items.length;a++){let o=n;n=r,r=o,a>1&&(n=(0,t.beginCell)().storeRef(r).storeRef(n).endCell());let s=(0,t.beginCell)();i(e.items[a],s),r=s.endCell()}a.storeUint(7,8),a.storeUint(e.items.length,16),n&&a.storeRef(n),r&&a.storeRef(r)}else throw Error(`Invalid value`)}e.serializeTupleItem=i;function a(e){let n=e.loadUint(8);if(n===0)return{type:`null`};if(n===1)return{type:`int`,value:e.loadIntBig(64)};if(n===2)return e.loadUint(7)===0?{type:`int`,value:e.loadIntBig(257)}:(e.loadBit(),{type:`nan`});if(n===3)return{type:`cell`,cell:e.loadRef()};if(n===4){let n=e.loadUint(10),r=e.loadUint(10),i=e.loadUint(3),a=e.loadUint(3),o=e.loadRef().beginParse();o.skip(n);let s=o.loadBits(r-n),c=(0,t.beginCell)().storeBits(s);if(i<a){for(let e=0;e<i;e++)o.loadRef();for(let e=0;e<a-i;e++)c.storeRef(o.loadRef())}return{type:`slice`,cell:c.endCell()}}else if(n===5)return{type:`builder`,cell:e.loadRef()};else if(n===7){let t=e.loadUint(16),n=[];if(t>1){let r=e.loadRef().beginParse(),i=e.loadRef().beginParse();n.unshift(a(i));for(let e=0;e<t-2;e++){let e=r;r=e.loadRef().beginParse(),i=e.loadRef().beginParse(),n.unshift(a(i))}n.unshift(a(r))}else t===1&&n.push(a(e.loadRef().beginParse()));return{type:`tuple`,items:n}}else throw Error(`Unsupported stack item`)}e.parseTupleItem=a;function o(e,n){if(e.length>0){let r=(0,t.beginCell)();o(e.slice(0,e.length-1),r),n.storeRef(r.endCell()),i(e[e.length-1],n)}}function s(e){let n=(0,t.beginCell)();return n.storeUint(e.length,24),o([...e],n),n.endCell()}e.serializeTuple=s;function c(e){let t=[],n=e.beginParse(),r=n.loadUint(24);for(let e=0;e<r;e++){let e=n.loadRef();t.unshift(a(n)),n=e.beginParse()}return t}e.parseTuple=c})),Dr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TupleReader=void 0,e.TupleReader=class e{constructor(e){this.items=[...e]}get remaining(){return this.items.length}peek(){if(this.items.length===0)throw Error(`EOF`);return this.items[0]}pop(){if(this.items.length===0)throw Error(`EOF`);let e=this.items[0];return this.items.splice(0,1),e}skip(e=1){for(let t=0;t<e;t++)this.pop();return this}readBigNumber(){let e=this.pop();if(e.type!==`int`)throw Error(`Not a number`);return e.value}readBigNumberOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`int`)throw Error(`Not a number`);return e.value}readNumber(){return Number(this.readBigNumber())}readNumberOpt(){let e=this.readBigNumberOpt();return e===null?null:Number(e)}readBoolean(){return this.readNumber()!==0}readBooleanOpt(){let e=this.readNumberOpt();return e===null?null:e!==0}readAddress(){let e=this.readCell().beginParse().loadAddress();if(e!==null)return e;throw Error(`Not an address`)}readAddressOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadMaybeAddress()}readCell(){let e=this.pop();if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell: `+e.type);return e.cell}readCellOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell`);return e.cell}readTuple(){let t=this.pop();if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}readTupleOpt(){let t=this.pop();if(t.type===`null`)return null;if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}static readLispList(e){let t=[],n=e;for(;n!==null;){var r=n.pop();if(n.items.length===0||n.items[0].type!==`tuple`&&n.items[0].type!==`null`)throw Error(`Lisp list consists only from (any, tuple) elements and ends with null`);n=n.readTupleOpt(),t.push(r)}return t}readLispListDirect(){return this.items.length===1&&this.items[0].type===`null`?[]:e.readLispList(this)}readLispList(){return e.readLispList(this.readTupleOpt())}readBuffer(){let e=this.readCell().beginParse();if(e.remainingRefs!==0||e.remainingBits%8!=0)throw Error(`Not a buffer`);return e.loadBuffer(e.remainingBits/8)}readBufferOpt(){let e=this.readCellOpt();if(e!==null){let t=e.beginParse();if(t.remainingRefs!==0||t.remainingBits%8!=0)throw Error(`Not a buffer`);return t.loadBuffer(t.remainingBits/8)}else return null}readString(){return this.readCell().beginParse().loadStringTail()}readStringOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadStringTail()}}})),Or=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TupleBuilder=void 0;var t=Q(),n=xr(),r=lr();e.TupleBuilder=class{constructor(){this._tuple=[]}writeNumber(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:BigInt(e)})}writeBoolean(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:e?-1n:0n})}writeBuffer(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeBuffer(e).endCell()})}writeString(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeStringTail(e).endCell()})}writeCell(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`cell`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`cell`,cell:e.asCell()})}writeSlice(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`slice`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`slice`,cell:e.asCell()})}writeBuilder(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`builder`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`builder`,cell:e.asCell()})}writeTuple(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`tuple`,items:e})}writeAddress(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeAddress(e).endCell()})}build(){return[...this._tuple]}}})),kr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.fromNano=e.toNano=void 0;function t(e){if(typeof e==`bigint`)return e*1000000000n;{if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid number`);if(Math.log10(e)<=6)e=e.toLocaleString(`en`,{minimumFractionDigits:9,useGrouping:!1});else if(e-Math.trunc(e)===0)e=e.toLocaleString(`en`,{maximumFractionDigits:0,useGrouping:!1});else throw Error(`Not enough precision for a number value. Use string value instead`)}let t=!1;for(;e.startsWith(`-`);)t=!t,e=e.slice(1);if(e===`.`)throw Error(`Invalid number`);let n=e.split(`.`);if(n.length>2)throw Error(`Invalid number`);let r=n[0],i=n[1];if(r||=`0`,i||=`0`,i.length>9)throw Error(`Invalid number`);for(;i.length<9;)i+=`0`;let a=BigInt(r)*1000000000n+BigInt(i);return t&&(a=-a),a}}e.toNano=t;function n(e){let t=BigInt(e),n=!1;t<0&&(n=!0,t=-t);let r=(t%1000000000n).toString();for(;r.length<9;)r=`0`+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];let i=`${(t/1000000000n).toString()}${r===`0`?``:`.${r}`}`;return n&&(i=`-`+i),i}e.fromNano=n})),Ar=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.packExtraCurrencyCell=e.packExtraCurrencyDict=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=void 0;var t=Q(),n=sr();function r(e){let t=e instanceof n.Dictionary?e:n.Dictionary.loadDirect(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5),e),r={};for(let[e,n]of t)r[e]=n;return r}e.loadExtraCurrency=r;function i(e){let t=e.loadMaybeRef();return t===null?t:r(t)}e.loadMaybeExtraCurrency=i;function a(e){return t=>{t.storeDict(o(e))}}e.storeExtraCurrency=a;function o(e){let t=n.Dictionary.empty(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5));return Object.entries(e).map(([e,n])=>t.set(Number(e),n)),t}e.packExtraCurrencyDict=o;function s(e){return(0,t.beginCell)().storeDictDirect(o(e)).endCell()}e.packExtraCurrencyCell=s})),jr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.comment=e.external=e.internal=void 0;var t=Wn(),n=xr(),r=Q(),i=kr(),a=Ar();function o(e){let o=!0;e.bounce!==null&&e.bounce!==void 0&&(o=e.bounce);let s;if(typeof e.to==`string`)s=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))s=e.to;else throw Error(`Invalid address ${e.to}`);let c;c=typeof e.value==`string`?(0,i.toNano)(e.value):e.value;let l;e.extracurrency&&(l=(0,a.packExtraCurrencyDict)(e.extracurrency));let u=n.Cell.EMPTY;return typeof e.body==`string`?u=(0,r.beginCell)().storeUint(0,32).storeStringTail(e.body).endCell():e.body&&(u=e.body),{info:{type:`internal`,dest:s,value:{coins:c,other:l},bounce:o,ihrDisabled:!0,bounced:!1,ihrFee:0n,forwardFee:0n,createdAt:0,createdLt:0n},init:e.init??void 0,body:u}}e.internal=o;function s(e){let r;if(typeof e.to==`string`)r=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))r=e.to;else throw Error(`Invalid address ${e.to}`);return{info:{type:`external-in`,dest:r,importFee:0n},init:e.init??void 0,body:e.body||n.Cell.EMPTY}}e.external=s;function c(e){return(0,r.beginCell)().storeUint(0,32).storeStringTail(e).endCell()}e.comment=c})),Mr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeAccountState=e.loadAccountState=void 0;var t=wr();function n(e){return e.loadBit()?{type:`active`,state:(0,t.loadStateInit)(e)}:e.loadBit()?{type:`frozen`,stateHash:e.loadUintBig(256)}:{type:`uninit`}}e.loadAccountState=n;function r(e){return n=>{e.type===`active`?(n.storeBit(!0),n.store((0,t.storeStateInit)(e.state))):e.type===`frozen`?(n.storeBit(!1),n.storeBit(!0),n.storeUint(e.stateHash,256)):e.type===`uninit`&&(n.storeBit(!1),n.storeBit(!1))}}e.storeAccountState=r})),Nr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeCurrencyCollection=e.loadCurrencyCollection=void 0;var t=sr();function n(e){let n=e.loadCoins(),r=e.loadDict(t.Dictionary.Keys.Uint(32),t.Dictionary.Values.BigVarUint(5));return r.size===0?{coins:n}:{other:r,coins:n}}e.loadCurrencyCollection=n;function r(e){return t=>{t.storeCoins(e.coins),e.other?t.storeDict(e.other):t.storeBit(0)}}e.storeCurrencyCollection=r})),Pr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeAccountStorage=e.loadAccountStorage=void 0;var t=Mr(),n=Nr();function r(e){return{lastTransLt:e.loadUintBig(64),balance:(0,n.loadCurrencyCollection)(e),state:(0,t.loadAccountState)(e)}}e.loadAccountStorage=r;function i(e){return r=>{r.storeUint(e.lastTransLt,64),r.store((0,n.storeCurrencyCollection)(e.balance)),r.store((0,t.storeAccountState)(e.state))}}e.storeAccountStorage=i})),Fr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeStorageExtraInfo=e.loadStorageExtraInfo=void 0;function t(e){let t=e.loadUint(3);if(t===0)return null;if(t===1)return{dictHash:e.loadUintBig(256)};throw Error(`Invalid storage extra info header: ${t}`)}e.loadStorageExtraInfo=t;function n(e){return t=>{e==null?t.storeUint(0,3):(t.storeUint(1,3),t.storeUint(e.dictHash,256))}}e.storeStorageExtraInfo=n})),Ir=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeStorageUsed=e.loadStorageUsed=void 0;function t(e){return{cells:e.loadVarUintBig(3),bits:e.loadVarUintBig(3)}}e.loadStorageUsed=t;function n(e){return t=>{t.storeVarUint(e.cells,3),t.storeVarUint(e.bits,3)}}e.storeStorageUsed=n})),Lr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeStorageInfo=e.loadStorageInfo=void 0;var t=Fr(),n=Ir();function r(e){return{used:(0,n.loadStorageUsed)(e),storageExtra:(0,t.loadStorageExtraInfo)(e),lastPaid:e.loadUint(32),duePayment:e.loadMaybeCoins()}}e.loadStorageInfo=r;function i(e){return r=>{r.store((0,n.storeStorageUsed)(e.used)),r.store((0,t.storeStorageExtraInfo)(e.storageExtra)),r.storeUint(e.lastPaid,32),r.storeMaybeCoins(e.duePayment)}}e.storeStorageInfo=i})),Rr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeAccount=e.loadAccount=void 0;var t=Pr(),n=Lr();function r(e){return{addr:e.loadAddress(),storageStats:(0,n.loadStorageInfo)(e),storage:(0,t.loadAccountStorage)(e)}}e.loadAccount=r;function i(e){return r=>{r.storeAddress(e.addr),r.store((0,n.storeStorageInfo)(e.storageStats)),r.store((0,t.storeAccountStorage)(e.storage))}}e.storeAccount=i})),zr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeAccountStatus=e.loadAccountStatus=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`uninitialized`;if(t===1)return`frozen`;if(t===2)return`active`;if(t===3)return`non-existing`;throw Error(`Invalid data`)}e.loadAccountStatus=t;function n(e){return t=>{if(e===`uninitialized`)t.storeUint(0,2);else if(e===`frozen`)t.storeUint(1,2);else if(e===`active`)t.storeUint(2,2);else if(e===`non-existing`)t.storeUint(3,2);else throw Error(`Invalid data`);return t}}e.storeAccountStatus=n})),Br=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeAccountStatusChange=e.loadAccountStatusChange=void 0;function t(e){return e.loadBit()?e.loadBit()?`deleted`:`frozen`:`unchanged`}e.loadAccountStatusChange=t;function n(e){return t=>{if(e==`unchanged`)t.storeBit(0);else if(e===`frozen`)t.storeBit(1),t.storeBit(0);else if(e===`deleted`)t.storeBit(1),t.storeBit(1);else throw Error(`Invalid account status change`)}}e.storeAccountStatusChange=n})),Vr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=void 0;var t=Nr();function n(e){if(!e.loadBit())return{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadMaybeAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)};if(!e.loadBit())throw Error(`External In message is not possible for CommonMessageInfoRelaxed`);return{type:`external-out`,src:e.loadMaybeAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfoRelaxed=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfoRelaxed=r})),Hr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeMessageRelaxed=e.loadMessageRelaxed=void 0;var t=Q(),n=Vr(),r=wr();function i(e){let t=(0,n.loadCommonMessageInfoRelaxed)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessageRelaxed=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfoRelaxed)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:!(a.availableBits-2>=n.bits),o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:!(a.availableBits-1>=e.body.bits.length&&a.refs+e.body.refs.length<=4&&!e.body.isExotic),o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessageRelaxed=a})),Ur=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeLibRef=e.loadLibRef=void 0;function t(e){return e.loadUint(1)===0?{type:`hash`,libHash:e.loadBuffer(32)}:{type:`ref`,library:e.loadRef()}}e.loadLibRef=t;function n(e){return t=>{e.type===`hash`?(t.storeUint(0,1),t.storeBuffer(e.libHash)):(t.storeUint(1,1),t.storeRef(e.library))}}e.storeLibRef=n})),Wr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.loadOutList=e.storeOutList=e.loadOutAction=e.storeOutAction=void 0;var t=Hr(),n=Q(),r=Nr(),i=Ur();function a(e){switch(e.type){case`sendMsg`:return s(e);case`setCode`:return l(e);case`reserve`:return d(e);case`changeLibrary`:return p(e);default:throw Error(`Unknown action type ${e.type}`)}}e.storeOutAction=a;var o=247711853;function s(e){return r=>{r.storeUint(o,32).storeUint(e.mode,8).storeRef((0,n.beginCell)().store((0,t.storeMessageRelaxed)(e.outMsg)).endCell())}}var c=2907562126;function l(e){return t=>{t.storeUint(c,32).storeRef(e.newCode)}}var u=921090057;function d(e){return t=>{t.storeUint(u,32).storeUint(e.mode,8).store((0,r.storeCurrencyCollection)(e.currency))}}var f=653925844;function p(e){return t=>{t.storeUint(f,32).storeUint(e.mode,7).store((0,i.storeLibRef)(e.libRef))}}function m(e){let n=e.loadUint(32);if(n===o)return{type:`sendMsg`,mode:e.loadUint(8),outMsg:(0,t.loadMessageRelaxed)(e.loadRef().beginParse())};if(n===c)return{type:`setCode`,newCode:e.loadRef()};if(n===u)return{type:`reserve`,mode:e.loadUint(8),currency:(0,r.loadCurrencyCollection)(e)};if(n===f)return{type:`changeLibrary`,mode:e.loadUint(7),libRef:(0,i.loadLibRef)(e)};throw Error(`Unknown out action tag 0x${n.toString(16)}`)}e.loadOutAction=m;function h(e){let t=e.reduce((e,t)=>(0,n.beginCell)().storeRef(e).store(a(t)).endCell(),(0,n.beginCell)().endCell());return e=>{e.storeSlice(t.beginParse())}}e.storeOutList=h;function g(e){let t=[];for(;e.remainingRefs;){let n=e.loadRef();t.push(m(e)),e=n.beginParse()}return t.reverse()}e.loadOutList=g})),Gr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeCommonMessageInfo=e.loadCommonMessageInfo=void 0;var t=Nr();function n(e){return e.loadBit()?e.loadBit()?{type:`external-out`,src:e.loadAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}:{type:`external-in`,src:e.loadMaybeExternalAddress(),dest:e.loadAddress(),importFee:e.loadCoins()}:{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfo=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-in`)n.storeBit(1),n.storeBit(0),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeCoins(e.importFee);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfo=r})),Kr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeComputeSkipReason=e.loadComputeSkipReason=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`no-state`;if(t===1)return`bad-state`;if(t===2)return`no-gas`;throw Error(`Unknown ComputeSkipReason: ${t}`)}e.loadComputeSkipReason=t;function n(e){return t=>{if(e===`no-state`)t.storeUint(0,2);else if(e===`bad-state`)t.storeUint(1,2);else if(e===`no-gas`)t.storeUint(2,2);else throw Error(`Unknown ComputeSkipReason: ${e}`)}}e.storeComputeSkipReason=n})),qr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=void 0;var t=Nr();function n(e){return{splitDepth:e.loadUint(5),balance:(0,t.loadCurrencyCollection)(e)}}e.loadDepthBalanceInfo=n;function r(e){return n=>{n.storeUint(e.splitDepth,5),n.store((0,t.storeCurrencyCollection)(e.balance))}}e.storeDepthBalanceInfo=r})),Jr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeHashUpdate=e.loadHashUpdate=void 0;function t(e){if(e.loadUint(8)!==114)throw Error(`Invalid data`);return{oldHash:e.loadBuffer(32),newHash:e.loadBuffer(32)}}e.loadHashUpdate=t;function n(e){return t=>{t.storeUint(114,8),t.storeBuffer(e.oldHash),t.storeBuffer(e.newHash)}}e.storeHashUpdate=n})),Yr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.loadMasterchainStateExtra=void 0;var t=sr(),n=Nr();function r(e){if(e.loadUint(16)!==52262)throw Error(`Invalid data`);e.loadBit()&&e.loadRef();let r=e.loadUintBig(256);return{config:t.Dictionary.load(t.Dictionary.Keys.Int(32),t.Dictionary.Values.Cell(),e),configAddress:r,globalBalance:(0,n.loadCurrencyCollection)(e)}}e.loadMasterchainStateExtra=r})),Xr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MessageValue=e.storeMessage=e.loadMessage=void 0;var t=Q(),n=Gr(),r=wr();function i(e){let t=(0,n.loadCommonMessageInfo)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessage=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfo)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:a.availableBits-2<n.bits+e.body.bits.length,o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:a.availableBits-1<e.body.bits.length||a.refs+e.body.refs.length>4,o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessage=a,e.MessageValue={serialize(e,n){n.storeRef((0,t.beginCell)().store(a(e)))},parse(e){return i(e.loadRef().beginParse())}}})),Zr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SendMode=void 0;var t;(function(e){e[e.CARRY_ALL_REMAINING_BALANCE=128]=`CARRY_ALL_REMAINING_BALANCE`,e[e.CARRY_ALL_REMAINING_INCOMING_VALUE=64]=`CARRY_ALL_REMAINING_INCOMING_VALUE`,e[e.DESTROY_ACCOUNT_IF_ZERO=32]=`DESTROY_ACCOUNT_IF_ZERO`,e[e.PAY_GAS_SEPARATELY=1]=`PAY_GAS_SEPARATELY`,e[e.IGNORE_ERRORS=2]=`IGNORE_ERRORS`,e[e.NONE=0]=`NONE`})(t||(e.SendMode=t={}))})),Qr=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReserveMode=void 0;var t;(function(e){e[e.THIS_AMOUNT=0]=`THIS_AMOUNT`,e[e.LEAVE_THIS_AMOUNT=1]=`LEAVE_THIS_AMOUNT`,e[e.AT_MOST_THIS_AMOUNT=2]=`AT_MOST_THIS_AMOUNT`,e[e.LEAVE_MAX_THIS_AMOUNT=3]=`LEAVE_MAX_THIS_AMOUNT`,e[e.BEFORE_BALANCE_PLUS_THIS_AMOUNT=4]=`BEFORE_BALANCE_PLUS_THIS_AMOUNT`,e[e.LEAVE_BBALANCE_PLUS_THIS_AMOUNT=5]=`LEAVE_BBALANCE_PLUS_THIS_AMOUNT`,e[e.BEFORE_BALANCE_MINUS_THIS_AMOUNT=12]=`BEFORE_BALANCE_MINUS_THIS_AMOUNT`,e[e.LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT=13]=`LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT`})(t||(e.ReserveMode=t={}))})),$r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeShardAccount=e.loadShardAccount=void 0;var t=Q(),n=Rr();function r(e){let t=e.loadRef(),r;if(!t.isExotic){let e=t.beginParse();e.loadBit()&&(r=(0,n.loadAccount)(e))}return{account:r,lastTransactionHash:e.loadUintBig(256),lastTransactionLt:e.loadUintBig(64)}}e.loadShardAccount=r;function i(e){return r=>{e.account?r.storeRef((0,t.beginCell)().storeBit(!0).store((0,n.storeAccount)(e.account))):r.storeRef((0,t.beginCell)().storeBit(!1)),r.storeUint(e.lastTransactionHash,256),r.storeUint(e.lastTransactionLt,64)}}e.storeShardAccount=i})),ei=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=void 0;var t=sr(),n=qr(),r=$r();e.ShardAccountRefValue={parse:e=>({depthBalanceInfo:(0,n.loadDepthBalanceInfo)(e),shardAccount:(0,r.loadShardAccount)(e)}),serialize(e,t){t.store((0,n.storeDepthBalanceInfo)(e.depthBalanceInfo)),t.store((0,r.storeShardAccount)(e.shardAccount))}};function i(n){return t.Dictionary.load(t.Dictionary.Keys.BigUint(256),e.ShardAccountRefValue,n)}e.loadShardAccounts=i;function a(e){return t=>{t.storeDict(e)}}e.storeShardAccounts=a})),ti=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeShardIdent=e.loadShardIdent=void 0;function t(e){if(e.loadUint(2)!==0)throw Error(`Invalid data`);return{shardPrefixBits:e.loadUint(6),workchainId:e.loadInt(32),shardPrefix:e.loadUintBig(64)}}e.loadShardIdent=t;function n(e){return t=>{t.storeUint(0,2),t.storeUint(e.shardPrefixBits,6),t.storeInt(e.workchainId,32),t.storeUint(e.shardPrefix,64)}}e.storeShardIdent=n})),ni=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.loadShardStateUnsplit=void 0;var t=Yr(),n=ei(),r=ti();function i(e){if(e.loadUint(32)!==2418257890)throw Error(`Invalid data`);let i=e.loadInt(32),a=(0,r.loadShardIdent)(e),o=e.loadUint(32),s=e.loadUint(32),c=e.loadUint(32),l=e.loadUintBig(64),u=e.loadUint(32);e.loadRef();let d=e.loadBit(),f=e.loadRef(),p;f.isExotic||(p=(0,n.loadShardAccounts)(f.beginParse())),e.loadRef();let m=e.loadBit(),h=null;if(m){let n=e.loadRef();n.isExotic||(h=(0,t.loadMasterchainStateExtra)(n.beginParse()))}return{globalId:i,shardId:a,seqno:o,vertSeqNo:s,genUtime:c,genLt:l,minRefMcSeqno:u,beforeSplit:d,accounts:p,extras:h}}e.loadShardStateUnsplit=i})),ri=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeSplitMergeInfo=e.loadSplitMergeInfo=void 0;function t(e){return{currentShardPrefixLength:e.loadUint(6),accountSplitDepth:e.loadUint(6),thisAddress:e.loadUintBig(256),siblingAddress:e.loadUintBig(256)}}e.loadSplitMergeInfo=t;function n(e){return t=>{t.storeUint(e.currentShardPrefixLength,6),t.storeUint(e.accountSplitDepth,6),t.storeUint(e.thisAddress,256),t.storeUint(e.siblingAddress,256)}}e.storeSplitMergeInfo=n})),ii=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransactionActionPhase=e.loadTransactionActionPhase=void 0;var t=Br(),n=Ir();function r(e){return{success:e.loadBit(),valid:e.loadBit(),noFunds:e.loadBit(),statusChange:(0,t.loadAccountStatusChange)(e),totalFwdFees:e.loadBit()?e.loadCoins():void 0,totalActionFees:e.loadBit()?e.loadCoins():void 0,resultCode:e.loadInt(32),resultArg:e.loadBit()?e.loadInt(32):void 0,totalActions:e.loadUint(16),specActions:e.loadUint(16),skippedActions:e.loadUint(16),messagesCreated:e.loadUint(16),actionListHash:e.loadUintBig(256),totalMessageSize:(0,n.loadStorageUsed)(e)}}e.loadTransactionActionPhase=r;function i(e){return r=>{r.storeBit(e.success),r.storeBit(e.valid),r.storeBit(e.noFunds),r.store((0,t.storeAccountStatusChange)(e.statusChange)),r.storeMaybeCoins(e.totalFwdFees),r.storeMaybeCoins(e.totalActionFees),r.storeInt(e.resultCode,32),r.storeMaybeInt(e.resultArg,32),r.storeUint(e.totalActions,16),r.storeUint(e.specActions,16),r.storeUint(e.skippedActions,16),r.storeUint(e.messagesCreated,16),r.storeUint(e.actionListHash,256),r.store((0,n.storeStorageUsed)(e.totalMessageSize))}}e.storeTransactionActionPhase=i})),ai=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=void 0;var t=Ir();function n(e){return e.loadBit()?{type:`ok`,messageSize:(0,t.loadStorageUsed)(e),messageFees:e.loadCoins(),forwardFees:e.loadCoins()}:e.loadBit()?{type:`no-funds`,messageSize:(0,t.loadStorageUsed)(e),requiredForwardFees:e.loadCoins()}:{type:`negative-funds`}}e.loadTransactionBouncePhase=n;function r(e){return n=>{if(e.type===`ok`)n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.messageFees),n.storeCoins(e.forwardFees);else if(e.type===`negative-funds`)n.storeBit(!1),n.storeBit(!1);else if(e.type===`no-funds`)n.storeBit(!1),n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.requiredForwardFees);else throw Error(`Invalid TransactionBouncePhase type`)}}e.storeTransactionBouncePhase=r})),oi=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransactionComputePhase=e.loadTransactionComputePhase=void 0;var t=Q(),n=Kr();function r(e){if(!e.loadBit())return{type:`skipped`,reason:(0,n.loadComputeSkipReason)(e)};let t=e.loadBit(),r=e.loadBit(),i=e.loadBit(),a=e.loadCoins(),o=e.loadRef().beginParse();return{type:`vm`,success:t,messageStateUsed:r,accountActivated:i,gasFees:a,gasUsed:o.loadVarUintBig(3),gasLimit:o.loadVarUintBig(3),gasCredit:o.loadBit()?o.loadVarUintBig(2):void 0,mode:o.loadUint(8),exitCode:o.loadInt(32),exitArg:o.loadBit()?o.loadInt(32):void 0,vmSteps:o.loadUint(32),vmInitStateHash:o.loadUintBig(256),vmFinalStateHash:o.loadUintBig(256)}}e.loadTransactionComputePhase=r;function i(e){return r=>{if(e.type===`skipped`){r.storeBit(0),r.store((0,n.storeComputeSkipReason)(e.reason));return}r.storeBit(1),r.storeBit(e.success),r.storeBit(e.messageStateUsed),r.storeBit(e.accountActivated),r.storeCoins(e.gasFees),r.storeRef((0,t.beginCell)().storeVarUint(e.gasUsed,3).storeVarUint(e.gasLimit,3).store(t=>e.gasCredit!==void 0&&e.gasCredit!==null?t.storeBit(1).storeVarUint(e.gasCredit,2):t.storeBit(0)).storeUint(e.mode,8).storeInt(e.exitCode,32).store(t=>e.exitArg!==void 0&&e.exitArg!==null?t.storeBit(1).storeInt(e.exitArg,32):t.storeBit(0)).storeUint(e.vmSteps,32).storeUint(e.vmInitStateHash,256).storeUint(e.vmFinalStateHash,256).endCell())}}e.storeTransactionComputePhase=i})),si=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=void 0;var t=Nr();function n(e){return{dueFeesColelcted:e.loadBit()?e.loadCoins():void 0,credit:(0,t.loadCurrencyCollection)(e)}}e.loadTransactionCreditPhase=n;function r(e){return n=>{e.dueFeesColelcted===null||e.dueFeesColelcted===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.dueFeesColelcted)),n.store((0,t.storeCurrencyCollection)(e.credit))}}e.storeTransactionCreditPhase=r})),ci=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=void 0;var t=Br();function n(e){let n=e.loadCoins(),r;e.loadBit()&&(r=e.loadCoins());let i=(0,t.loadAccountStatusChange)(e);return{storageFeesCollected:n,storageFeesDue:r,statusChange:i}}e.loadTransactionStoragePhase=n;function r(e){return n=>{n.storeCoins(e.storageFeesCollected),e.storageFeesDue===null||e.storageFeesDue===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.storageFeesDue)),n.store((0,t.storeAccountStatusChange)(e.statusChange))}}e.storeTransactionsStoragePhase=r})),li=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransactionDescription=e.loadTransactionDescription=void 0;var t=Q(),n=ri(),r=ui(),i=ii(),a=ai(),o=oi(),s=si(),c=ci();function l(e){let t=e.loadUint(4);if(t===0){let t=e.loadBit(),n;e.loadBit()&&(n=(0,c.loadTransactionStoragePhase)(e));let r;e.loadBit()&&(r=(0,s.loadTransactionCreditPhase)(e));let l=(0,o.loadTransactionComputePhase)(e),u;e.loadBit()&&(u=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let d=e.loadBit(),f;e.loadBit()&&(f=(0,a.loadTransactionBouncePhase)(e));let p=e.loadBit();return{type:`generic`,creditFirst:t,storagePhase:n,creditPhase:r,computePhase:l,actionPhase:u,bouncePhase:f,aborted:d,destroyed:p}}if(t===1)return{type:`storage`,storagePhase:(0,c.loadTransactionStoragePhase)(e)};if(t===2||t===3){let n=t===3,r=(0,c.loadTransactionStoragePhase)(e),a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`tick-tock`,isTock:n,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===4){let t=(0,n.loadSplitMergeInfo)(e),r;e.loadBit()&&(r=(0,c.loadTransactionStoragePhase)(e));let a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`split-prepare`,splitInfo:t,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===5)return{type:`split-install`,splitInfo:(0,n.loadSplitMergeInfo)(e),prepareTransaction:(0,r.loadTransaction)(e.loadRef().beginParse()),installed:e.loadBit()};throw Error(`Unsupported transaction description type ${t}`)}e.loadTransactionDescription=l;function u(e){return l=>{if(e.type===`generic`)l.storeUint(0,4),l.storeBit(e.creditFirst),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),e.creditPhase?(l.storeBit(!0),l.store((0,s.storeTransactionCreditPhase)(e.creditPhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),e.bouncePhase?(l.storeBit(!0),l.store((0,a.storeTransactionBouncePhase)(e.bouncePhase))):l.storeBit(!1),l.storeBit(e.destroyed);else if(e.type===`storage`)l.storeUint(1,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase));else if(e.type===`tick-tock`)l.storeUint(e.isTock?3:2,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase)),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-prepare`)l.storeUint(4,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.store((0,i.storeTransactionActionPhase)(e.actionPhase))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-install`)l.storeUint(5,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),l.storeRef((0,t.beginCell)().store((0,r.storeTransaction)(e.prepareTransaction))),l.storeBit(e.installed);else throw Error(`Unsupported transaction description type ${e.type}`)}}e.storeTransactionDescription=u})),ui=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.storeTransaction=e.loadTransaction=void 0;var t=Q(),n=sr(),r=zr(),i=Nr(),a=Jr(),o=Xr(),s=li();function c(e){let t=e.asCell();if(e.loadUint(4)!==7)throw Error(`Invalid data`);let c=e.loadUintBig(256),l=e.loadUintBig(64),u=e.loadUintBig(256),d=e.loadUintBig(64),f=e.loadUint(32),p=e.loadUint(15),m=(0,r.loadAccountStatus)(e),h=(0,r.loadAccountStatus)(e),g=e.loadRef().beginParse(),_=g.loadBit()?(0,o.loadMessage)(g.loadRef().beginParse()):void 0,v=g.loadDict(n.Dictionary.Keys.Uint(15),o.MessageValue);return g.endParse(),{address:c,lt:l,prevTransactionHash:u,prevTransactionLt:d,now:f,outMessagesCount:p,oldStatus:m,endStatus:h,inMessage:_,outMessages:v,totalFees:(0,i.loadCurrencyCollection)(e),stateUpdate:(0,a.loadHashUpdate)(e.loadRef().beginParse()),description:(0,s.loadTransactionDescription)(e.loadRef().beginParse()),raw:t,hash:()=>t.hash()}}e.loadTransaction=c;function l(e){return n=>{n.storeUint(7,4),n.storeUint(e.address,256),n.storeUint(e.lt,64),n.storeUint(e.prevTransactionHash,256),n.storeUint(e.prevTransactionLt,64),n.storeUint(e.now,32),n.storeUint(e.outMessagesCount,15),n.store((0,r.storeAccountStatus)(e.oldStatus)),n.store((0,r.storeAccountStatus)(e.endStatus));let c=(0,t.beginCell)();e.inMessage?(c.storeBit(!0),c.storeRef((0,t.beginCell)().store((0,o.storeMessage)(e.inMessage)))):c.storeBit(!1),c.storeDict(e.outMessages),n.storeRef(c),n.store((0,i.storeCurrencyCollection)(e.totalFees)),n.storeRef((0,t.beginCell)().store((0,a.storeHashUpdate)(e.stateUpdate))),n.storeRef((0,t.beginCell)().store((0,s.storeTransactionDescription)(e.description)))}}e.storeTransaction=l})),di=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.loadSimpleLibrary=e.loadShardStateUnsplit=e.storeShardIdent=e.loadShardIdent=e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=e.storeShardAccount=e.loadShardAccount=e.ReserveMode=e.SendMode=e.storeMessageRelaxed=e.loadMessageRelaxed=e.storeMessage=e.loadMessage=e.loadMasterchainStateExtra=e.storeHashUpdate=e.loadHashUpdate=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=e.packExtraCurrencyDict=e.packExtraCurrencyCell=e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=e.storeCurrencyCollection=e.loadCurrencyCollection=e.storeComputeSkipReason=e.loadComputeSkipReason=e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=e.storeCommonMessageInfo=e.loadCommonMessageInfo=e.storeOutList=e.loadOutList=e.storeOutAction=e.loadOutAction=e.storeAccountStorage=e.loadAccountStorage=e.storeAccountStatusChange=e.loadAccountStatusChange=e.storeAccountStatus=e.loadAccountStatus=e.storeAccountState=e.loadAccountState=e.storeAccount=e.loadAccount=e.comment=e.external=e.internal=void 0,e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=e.storeTransactionDescription=e.loadTransactionDescription=e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=e.storeTransactionComputePhase=e.loadTransactionComputePhase=e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=e.storeTransactionActionPhase=e.loadTransactionActionPhase=e.storeTransaction=e.loadTransaction=e.storeTickTock=e.loadTickTock=e.storeStorageUsed=e.loadStorageUsed=e.storeStorageInfo=e.loadStorageInfo=e.storeStateInit=e.loadStateInit=e.storeSplitMergeInfo=e.loadSplitMergeInfo=e.storeLibRef=e.loadLibRef=e.storeSimpleLibrary=void 0;var t=jr();Object.defineProperty(e,`internal`,{enumerable:!0,get:function(){return t.internal}}),Object.defineProperty(e,`external`,{enumerable:!0,get:function(){return t.external}}),Object.defineProperty(e,`comment`,{enumerable:!0,get:function(){return t.comment}});var n=Rr();Object.defineProperty(e,`loadAccount`,{enumerable:!0,get:function(){return n.loadAccount}}),Object.defineProperty(e,`storeAccount`,{enumerable:!0,get:function(){return n.storeAccount}});var r=Mr();Object.defineProperty(e,`loadAccountState`,{enumerable:!0,get:function(){return r.loadAccountState}}),Object.defineProperty(e,`storeAccountState`,{enumerable:!0,get:function(){return r.storeAccountState}});var i=zr();Object.defineProperty(e,`loadAccountStatus`,{enumerable:!0,get:function(){return i.loadAccountStatus}}),Object.defineProperty(e,`storeAccountStatus`,{enumerable:!0,get:function(){return i.storeAccountStatus}});var a=Br();Object.defineProperty(e,`loadAccountStatusChange`,{enumerable:!0,get:function(){return a.loadAccountStatusChange}}),Object.defineProperty(e,`storeAccountStatusChange`,{enumerable:!0,get:function(){return a.storeAccountStatusChange}});var o=Pr();Object.defineProperty(e,`loadAccountStorage`,{enumerable:!0,get:function(){return o.loadAccountStorage}}),Object.defineProperty(e,`storeAccountStorage`,{enumerable:!0,get:function(){return o.storeAccountStorage}});var s=Wr();Object.defineProperty(e,`loadOutAction`,{enumerable:!0,get:function(){return s.loadOutAction}}),Object.defineProperty(e,`storeOutAction`,{enumerable:!0,get:function(){return s.storeOutAction}}),Object.defineProperty(e,`loadOutList`,{enumerable:!0,get:function(){return s.loadOutList}}),Object.defineProperty(e,`storeOutList`,{enumerable:!0,get:function(){return s.storeOutList}});var c=Gr();Object.defineProperty(e,`loadCommonMessageInfo`,{enumerable:!0,get:function(){return c.loadCommonMessageInfo}}),Object.defineProperty(e,`storeCommonMessageInfo`,{enumerable:!0,get:function(){return c.storeCommonMessageInfo}});var l=Vr();Object.defineProperty(e,`loadCommonMessageInfoRelaxed`,{enumerable:!0,get:function(){return l.loadCommonMessageInfoRelaxed}}),Object.defineProperty(e,`storeCommonMessageInfoRelaxed`,{enumerable:!0,get:function(){return l.storeCommonMessageInfoRelaxed}});var u=Kr();Object.defineProperty(e,`loadComputeSkipReason`,{enumerable:!0,get:function(){return u.loadComputeSkipReason}}),Object.defineProperty(e,`storeComputeSkipReason`,{enumerable:!0,get:function(){return u.storeComputeSkipReason}});var d=Nr();Object.defineProperty(e,`loadCurrencyCollection`,{enumerable:!0,get:function(){return d.loadCurrencyCollection}}),Object.defineProperty(e,`storeCurrencyCollection`,{enumerable:!0,get:function(){return d.storeCurrencyCollection}});var f=qr();Object.defineProperty(e,`loadDepthBalanceInfo`,{enumerable:!0,get:function(){return f.loadDepthBalanceInfo}}),Object.defineProperty(e,`storeDepthBalanceInfo`,{enumerable:!0,get:function(){return f.storeDepthBalanceInfo}});var p=Ar();Object.defineProperty(e,`packExtraCurrencyCell`,{enumerable:!0,get:function(){return p.packExtraCurrencyCell}}),Object.defineProperty(e,`packExtraCurrencyDict`,{enumerable:!0,get:function(){return p.packExtraCurrencyDict}}),Object.defineProperty(e,`loadExtraCurrency`,{enumerable:!0,get:function(){return p.loadExtraCurrency}}),Object.defineProperty(e,`loadMaybeExtraCurrency`,{enumerable:!0,get:function(){return p.loadMaybeExtraCurrency}}),Object.defineProperty(e,`storeExtraCurrency`,{enumerable:!0,get:function(){return p.storeExtraCurrency}});var m=Jr();Object.defineProperty(e,`loadHashUpdate`,{enumerable:!0,get:function(){return m.loadHashUpdate}}),Object.defineProperty(e,`storeHashUpdate`,{enumerable:!0,get:function(){return m.storeHashUpdate}});var h=Yr();Object.defineProperty(e,`loadMasterchainStateExtra`,{enumerable:!0,get:function(){return h.loadMasterchainStateExtra}});var g=Xr();Object.defineProperty(e,`loadMessage`,{enumerable:!0,get:function(){return g.loadMessage}}),Object.defineProperty(e,`storeMessage`,{enumerable:!0,get:function(){return g.storeMessage}});var _=Hr();Object.defineProperty(e,`loadMessageRelaxed`,{enumerable:!0,get:function(){return _.loadMessageRelaxed}}),Object.defineProperty(e,`storeMessageRelaxed`,{enumerable:!0,get:function(){return _.storeMessageRelaxed}});var v=Zr();Object.defineProperty(e,`SendMode`,{enumerable:!0,get:function(){return v.SendMode}});var y=Qr();Object.defineProperty(e,`ReserveMode`,{enumerable:!0,get:function(){return y.ReserveMode}});var b=$r();Object.defineProperty(e,`loadShardAccount`,{enumerable:!0,get:function(){return b.loadShardAccount}}),Object.defineProperty(e,`storeShardAccount`,{enumerable:!0,get:function(){return b.storeShardAccount}});var x=ei();Object.defineProperty(e,`ShardAccountRefValue`,{enumerable:!0,get:function(){return x.ShardAccountRefValue}}),Object.defineProperty(e,`loadShardAccounts`,{enumerable:!0,get:function(){return x.loadShardAccounts}}),Object.defineProperty(e,`storeShardAccounts`,{enumerable:!0,get:function(){return x.storeShardAccounts}});var S=ti();Object.defineProperty(e,`loadShardIdent`,{enumerable:!0,get:function(){return S.loadShardIdent}}),Object.defineProperty(e,`storeShardIdent`,{enumerable:!0,get:function(){return S.storeShardIdent}});var C=ni();Object.defineProperty(e,`loadShardStateUnsplit`,{enumerable:!0,get:function(){return C.loadShardStateUnsplit}});var ee=Sr();Object.defineProperty(e,`loadSimpleLibrary`,{enumerable:!0,get:function(){return ee.loadSimpleLibrary}}),Object.defineProperty(e,`storeSimpleLibrary`,{enumerable:!0,get:function(){return ee.storeSimpleLibrary}});var w=Ur();Object.defineProperty(e,`loadLibRef`,{enumerable:!0,get:function(){return w.loadLibRef}}),Object.defineProperty(e,`storeLibRef`,{enumerable:!0,get:function(){return w.storeLibRef}});var te=ri();Object.defineProperty(e,`loadSplitMergeInfo`,{enumerable:!0,get:function(){return te.loadSplitMergeInfo}}),Object.defineProperty(e,`storeSplitMergeInfo`,{enumerable:!0,get:function(){return te.storeSplitMergeInfo}});var T=wr();Object.defineProperty(e,`loadStateInit`,{enumerable:!0,get:function(){return T.loadStateInit}}),Object.defineProperty(e,`storeStateInit`,{enumerable:!0,get:function(){return T.storeStateInit}});var E=Lr();Object.defineProperty(e,`loadStorageInfo`,{enumerable:!0,get:function(){return E.loadStorageInfo}}),Object.defineProperty(e,`storeStorageInfo`,{enumerable:!0,get:function(){return E.storeStorageInfo}});var D=Ir();Object.defineProperty(e,`loadStorageUsed`,{enumerable:!0,get:function(){return D.loadStorageUsed}}),Object.defineProperty(e,`storeStorageUsed`,{enumerable:!0,get:function(){return D.storeStorageUsed}});var ne=Cr();Object.defineProperty(e,`loadTickTock`,{enumerable:!0,get:function(){return ne.loadTickTock}}),Object.defineProperty(e,`storeTickTock`,{enumerable:!0,get:function(){return ne.storeTickTock}});var re=ui();Object.defineProperty(e,`loadTransaction`,{enumerable:!0,get:function(){return re.loadTransaction}}),Object.defineProperty(e,`storeTransaction`,{enumerable:!0,get:function(){return re.storeTransaction}});var ie=ii();Object.defineProperty(e,`loadTransactionActionPhase`,{enumerable:!0,get:function(){return ie.loadTransactionActionPhase}}),Object.defineProperty(e,`storeTransactionActionPhase`,{enumerable:!0,get:function(){return ie.storeTransactionActionPhase}});var ae=ai();Object.defineProperty(e,`loadTransactionBouncePhase`,{enumerable:!0,get:function(){return ae.loadTransactionBouncePhase}}),Object.defineProperty(e,`storeTransactionBouncePhase`,{enumerable:!0,get:function(){return ae.storeTransactionBouncePhase}});var oe=oi();Object.defineProperty(e,`loadTransactionComputePhase`,{enumerable:!0,get:function(){return oe.loadTransactionComputePhase}}),Object.defineProperty(e,`storeTransactionComputePhase`,{enumerable:!0,get:function(){return oe.storeTransactionComputePhase}});var se=si();Object.defineProperty(e,`loadTransactionCreditPhase`,{enumerable:!0,get:function(){return se.loadTransactionCreditPhase}}),Object.defineProperty(e,`storeTransactionCreditPhase`,{enumerable:!0,get:function(){return se.storeTransactionCreditPhase}});var ce=li();Object.defineProperty(e,`loadTransactionDescription`,{enumerable:!0,get:function(){return ce.loadTransactionDescription}}),Object.defineProperty(e,`storeTransactionDescription`,{enumerable:!0,get:function(){return ce.storeTransactionDescription}});var le=ci();Object.defineProperty(e,`loadTransactionStoragePhase`,{enumerable:!0,get:function(){return le.loadTransactionStoragePhase}}),Object.defineProperty(e,`storeTransactionsStoragePhase`,{enumerable:!0,get:function(){return le.storeTransactionsStoragePhase}})})),fi=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.openContract=void 0;var t=Wn(),n=xr();function r(e,r){let i,a=null;if(!t.Address.isAddress(e.address))throw Error(`Invalid address`);if(i=e.address,e.init){if(!(e.init.code instanceof n.Cell))throw Error(`Invalid init.code`);if(!(e.init.data instanceof n.Cell))throw Error(`Invalid init.data`);a=e.init}let o=r({address:i,init:a});return new Proxy(e,{get(e,t){let n=e[t];return typeof t==`string`&&(t.startsWith(`get`)||t.startsWith(`send`)||t.startsWith(`is`))&&typeof n==`function`?(...t)=>n.apply(e,[o,...t]):n}})}e.openContract=r})),pi=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ComputeError=void 0,e.ComputeError=class e extends Error{constructor(t,n,r){super(t),this.exitCode=n,this.debugLogs=r&&r.debugLogs?r.debugLogs:null,this.logs=r&&r.logs?r.logs:null,Object.setPrototypeOf(this,e.prototype)}}})),mi=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.getMethodId=void 0;var t=new Int16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);function n(e){e instanceof d||(e=d.from(e));let n=0;for(let r=0;r<e.length;r++){let i=e[r];n=(t[(n>>8^i)&255]^n<<8)&65535}return n}function r(e){return n(e)&65535|65536}e.getMethodId=r})),hi=e((e=>{u(),Object.defineProperty(e,`__esModule`,{value:!0}),e.safeSignVerify=e.safeSign=void 0;var t=ie(),n=8,r=64;function i(e,i){let a=d.from(i);if(a.length>r)throw Error(`Seed can be longer than 64 bytes`);if(a.length<n)throw Error(`Seed must be at least 8 bytes`);return(0,t.sha256_sync)(d.concat([d.from([255,255]),a,e.hash()]))}function a(e,n,r=`ton-safe-sign-magic`){return(0,t.sign)(i(e,r),n)}e.safeSign=a;function o(e,n,r,a=`ton-safe-sign-magic`){return(0,t.signVerify)(i(e,a),n,r)}e.safeSignVerify=o})),gi=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(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){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.safeSignVerify=e.safeSign=e.getMethodId=e.base32Encode=e.base32Decode=e.crc32c=e.crc16=e.fromNano=e.toNano=e.ComputeError=e.openContract=e.TupleBuilder=e.TupleReader=e.serializeTupleItem=e.parseTupleItem=e.serializeTuple=e.parseTuple=e.generateMerkleUpdate=e.generateMerkleProofDirect=e.generateMerkleProof=e.exoticPruned=e.exoticMerkleUpdate=e.convertToMerkleProof=e.exoticMerkleProof=e.Dictionary=e.Cell=e.CellType=e.Slice=e.beginCell=e.Builder=e.BitBuilder=e.BitReader=e.BitString=e.contractAddress=e.ADNLAddress=e.ExternalAddress=e.address=e.Address=void 0;var r=Wn();Object.defineProperty(e,`Address`,{enumerable:!0,get:function(){return r.Address}}),Object.defineProperty(e,`address`,{enumerable:!0,get:function(){return r.address}});var i=Gn();Object.defineProperty(e,`ExternalAddress`,{enumerable:!0,get:function(){return i.ExternalAddress}});var a=qn();Object.defineProperty(e,`ADNLAddress`,{enumerable:!0,get:function(){return a.ADNLAddress}});var o=Tr();Object.defineProperty(e,`contractAddress`,{enumerable:!0,get:function(){return o.contractAddress}});var s=Yn();Object.defineProperty(e,`BitString`,{enumerable:!0,get:function(){return s.BitString}});var c=$n();Object.defineProperty(e,`BitReader`,{enumerable:!0,get:function(){return c.BitReader}});var l=Xn();Object.defineProperty(e,`BitBuilder`,{enumerable:!0,get:function(){return l.BitBuilder}});var u=Q();Object.defineProperty(e,`Builder`,{enumerable:!0,get:function(){return u.Builder}}),Object.defineProperty(e,`beginCell`,{enumerable:!0,get:function(){return u.beginCell}});var d=lr();Object.defineProperty(e,`Slice`,{enumerable:!0,get:function(){return d.Slice}});var f=Zn();Object.defineProperty(e,`CellType`,{enumerable:!0,get:function(){return f.CellType}});var p=xr();Object.defineProperty(e,`Cell`,{enumerable:!0,get:function(){return p.Cell}});var m=sr();Object.defineProperty(e,`Dictionary`,{enumerable:!0,get:function(){return m.Dictionary}});var h=er();Object.defineProperty(e,`exoticMerkleProof`,{enumerable:!0,get:function(){return h.exoticMerkleProof}}),Object.defineProperty(e,`convertToMerkleProof`,{enumerable:!0,get:function(){return h.convertToMerkleProof}});var g=dr();Object.defineProperty(e,`exoticMerkleUpdate`,{enumerable:!0,get:function(){return g.exoticMerkleUpdate}});var _=pr();Object.defineProperty(e,`exoticPruned`,{enumerable:!0,get:function(){return _.exoticPruned}});var v=tr();Object.defineProperty(e,`generateMerkleProof`,{enumerable:!0,get:function(){return v.generateMerkleProof}}),Object.defineProperty(e,`generateMerkleProofDirect`,{enumerable:!0,get:function(){return v.generateMerkleProofDirect}});var y=nr();Object.defineProperty(e,`generateMerkleUpdate`,{enumerable:!0,get:function(){return y.generateMerkleUpdate}});var b=Er();Object.defineProperty(e,`parseTuple`,{enumerable:!0,get:function(){return b.parseTuple}}),Object.defineProperty(e,`serializeTuple`,{enumerable:!0,get:function(){return b.serializeTuple}}),Object.defineProperty(e,`parseTupleItem`,{enumerable:!0,get:function(){return b.parseTupleItem}}),Object.defineProperty(e,`serializeTupleItem`,{enumerable:!0,get:function(){return b.serializeTupleItem}});var x=Dr();Object.defineProperty(e,`TupleReader`,{enumerable:!0,get:function(){return x.TupleReader}});var S=Or();Object.defineProperty(e,`TupleBuilder`,{enumerable:!0,get:function(){return S.TupleBuilder}}),n(di(),e);var C=fi();Object.defineProperty(e,`openContract`,{enumerable:!0,get:function(){return C.openContract}});var ee=pi();Object.defineProperty(e,`ComputeError`,{enumerable:!0,get:function(){return ee.ComputeError}});var w=kr();Object.defineProperty(e,`toNano`,{enumerable:!0,get:function(){return w.toNano}}),Object.defineProperty(e,`fromNano`,{enumerable:!0,get:function(){return w.fromNano}});var te=Un();Object.defineProperty(e,`crc16`,{enumerable:!0,get:function(){return te.crc16}});var T=yr();Object.defineProperty(e,`crc32c`,{enumerable:!0,get:function(){return T.crc32c}});var E=Kn();Object.defineProperty(e,`base32Decode`,{enumerable:!0,get:function(){return E.base32Decode}}),Object.defineProperty(e,`base32Encode`,{enumerable:!0,get:function(){return E.base32Encode}});var D=mi();Object.defineProperty(e,`getMethodId`,{enumerable:!0,get:function(){return D.getMethodId}});var ne=hi();Object.defineProperty(e,`safeSign`,{enumerable:!0,get:function(){return ne.safeSign}}),Object.defineProperty(e,`safeSignVerify`,{enumerable:!0,get:function(){return ne.safeSignVerify}})}));u();var $=gi(),_i=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:e.toString(),recipient:t,family:n,fees:r.toString(),comment:i,payload:a?xi(a):void 0}),vi=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:new M(e),recipient:t,family:n,fees:new M(r),comment:i,payload:a?bi(a):void 0}),yi=e=>{try{return $.Cell.fromBase64(e)}catch{return d.from(e,`hex`)}},bi=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:$.Cell.fromBase64(e.message)};case`jetton-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),destination:$.Address.parse(e.destination),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?$.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?$.Cell.fromBase64(e.forwardPayload):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,newOwner:$.Address.parse(e.newOwner),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?$.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?$.Cell.fromBase64(e.forwardPayload):null};case`jetton-burn`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?yi(e.customPayload):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,address:$.Address.parse(e.address)};case`single-nominator-withdraw`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount)};case`tonstakers-deposit`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,appId:e.appId?BigInt(e.appId):null};case`vote-for-proposal`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,votingAddress:$.Address.parse(e.votingAddress),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:$.Address.parse(e.record.value.address),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:d.from(e.record.key,`hex`),value:e.record.value?$.Cell.fromBase64(e.record.value):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,swapId:d.from(e.swapId,`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit)};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit),amount:BigInt(e.amount)};case`vesting-send-msg-comment`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,sendMode:e.sendMode,value:BigInt(e.value),destination:$.Address.parse(e.destination),text:e.text};case`comment`:return e;default:return e}},xi=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:e.message.toBoc().toString(`base64`)};case`jetton-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),destination:e.destination.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,newOwner:e.newOwner.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null};case`jetton-burn`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload&&`toBoc`in e.customPayload?e.customPayload.toBoc().toString(`base64`):e.customPayload?e.customPayload.toString(`hex`):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,address:e.address.toRawString()};case`single-nominator-withdraw`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString()};case`tonstakers-deposit`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,appId:typeof e.appId==`bigint`?e.appId.toString():null};case`vote-for-proposal`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,votingAddress:e.votingAddress.toRawString(),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:e.record.value.address.toRawString(),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:e.record.key.toString(`hex`),value:e.record.value?e.record.value.toBoc().toString(`base64`):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,swapId:e.swapId.toString(`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString()};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString(),amount:e.amount.toString()};case`vesting-send-msg-comment`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,sendMode:e.sendMode,value:e.value.toString(),destination:e.destination.toRawString(),text:e.text};case`comment`:return e;default:return e}},Si=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:e.toString(),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o}),Ci=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:new M(e),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o});function wi({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,amount:e.toString(),recipient:o,mode:a,fees:r?r.toString():void 0,data:t,gasLimit:i}}function Ti({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,mode:a,amount:new M(e),recipient:o,fees:r?new M(r):void 0,data:t,gasLimit:i}}function Ei({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,memo:r,mode:i,recipient:a}}function Di({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:new M(e),family:t,fees:n?new M(n):void 0,memo:r,mode:i,recipient:a}}function Oi({amount:e,family:t,model:n,recipient:r,raw:i}){return{amount:e.toString(),family:t,model:JSON.stringify(n),recipient:r,raw:i}}function ki({family:e,amount:t,model:n,recipient:r,raw:i}){return{amount:new M(t),family:e,model:JSON.parse(n),recipient:r,raw:i}}var Ai=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:e.toString(),recipient:t,family:n,estimatedFees:r,body:i}),ji=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:new M(e),recipient:t,family:n,estimatedFees:r,body:i}),Mi=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:e.toString(),recipient:t,family:n,fee:r?.toString(),nonce:i?.toString(),memo:a,network:o,anchorMode:s}),Ni=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:new M(e),recipient:t,family:n,fee:r?new M(r):void 0,nonce:i?new M(i):void 0,memo:a,network:o===`mainnet`?o:`testnet`,anchorMode:s}),Pi=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),memo:i}),Fi=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:new M(e),recipient:t,family:n,fees:new M(r),memo:i}),Ii=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),transferId:i}),Li=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:new M(e),recipient:t,family:n,fees:new M(r),transferId:i});function Ri({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function zi({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new M(e),recipient:t,family:n,mode:r,fees:i?new M(i):void 0}}function Bi(e){switch(e.family){case`ethereum`:return Sn(e);case`bitcoin`:return mn(e);case`algorand`:return un(e);case`aptos`:return fn(e);case`crypto_org`:return bn(e);case`ripple`:return In(e);case`celo`:return gn(e);case`cosmos`:return vn(e);case`hedera`:return En(e);case`kaspa`:return On(e);case`filecoin`:return An(e);case`tezos`:return Bn(e);case`polkadot`:return Pn(e);case`stellar`:return Rn(e);case`ton`:return _i(e);case`tron`:return Si(e);case`near`:return wn(e);case`neo`:return Mn(e);case`elrond`:return wi(e);case`cardano`:return Ei(e);case`solana`:return Oi(e);case`vechain`:return Ai(e);case`stacks`:return Mi(e);case`internet_computer`:return Pi(e);case`casper`:return Ii(e);case`sui`:return Ri(e);default:return e}}function Vi(e){switch(e.family){case`ethereum`:return Cn(e);case`bitcoin`:return hn(e);case`algorand`:return dn(e);case`aptos`:return pn(e);case`crypto_org`:return xn(e);case`ripple`:return Ln(e);case`celo`:return _n(e);case`cosmos`:return yn(e);case`hedera`:return Dn(e);case`kaspa`:return kn(e);case`filecoin`:return jn(e);case`tezos`:return Vn(e);case`polkadot`:return Fn(e);case`stellar`:return zn(e);case`ton`:return vi(e);case`tron`:return Ci(e);case`near`:return Tn(e);case`neo`:return Nn(e);case`elrond`:return Ti(e);case`cardano`:return Di(e);case`solana`:return ki(e);case`vechain`:return ji(e);case`stacks`:return Ni(e);case`internet_computer`:return Fi(e);case`casper`:return Li(e);case`sui`:return zi(e);default:return e}}var Hi=Y([`send`,`optIn`,`claimReward`,`optOut`]),Ui=X.extend({family:J(Z.enum.algorand),mode:Hi,fees:H().optional(),assetId:H().optional(),memo:H().optional()}),Wi=Y([`send`]),Gi=X.extend({family:J(Z.enum.aptos),mode:Wi,fees:H().optional()}),Ki=X.extend({family:J(Z.enum.bitcoin),feePerByte:H().optional(),opReturnDataHex:H().max(160).optional(),changeAddress:H().optional()}),qi=Y([`send`,`lock`,`unlock`,`withdraw`,`vote`,`revoke`,`activate`,`register`]),Ji=X.extend({family:J(Z.enum.celo),fees:H().optional().nullable(),mode:qi,index:U().optional().nullable()}),Yi=Y([`send`,`delegate`,`undelegate`,`redelegate`,`claimReward`,`claimRewardCompound`]),Xi=K({address:H(),amount:H()}),Zi=X.extend({family:J(Z.enum.cosmos),mode:Yi,fees:H().optional(),gas:H().optional(),memo:H().optional(),sourceValidator:H().optional(),validators:G(Xi).optional()}),Qi=X.extend({family:J(Z.enum.crypto_org),mode:H(),fees:H().optional()}),$i=X.extend({family:J(Z.enum.ethereum),nonce:U().optional(),data:H().optional(),gasPrice:H().optional(),gasLimit:H().optional(),maxPriorityFeePerGas:H().optional(),maxFeePerGas:H().optional(),sponsored:Xt().optional()}),ea=X.extend({family:J(Z.enum.near),mode:H(),fees:H().optional()}),ta=X.extend({family:J(Z.enum.neo)}),na=Y([`send`,`bond`,`unbond`,`rebond`,`withdrawUnbonded`,`setController`,`nominate`,`chill`,`claimReward`]),ra=Y([`Staked`,`Stash`,`Controller`,`Account`,`None`]),ia=X.extend({family:J(Z.enum.polkadot),mode:na,fee:H().optional(),era:U().optional(),validators:G(H()).optional(),rewardDestination:ra.optional(),numOfSlashingSpans:U().optional()}),aa=X.extend({family:J(Z.enum.ripple),fee:H().optional(),tag:U()}),oa=X.extend({family:J(Z.enum.solana),model:H(),raw:rn(H())}),sa=Y([`MEMO_TEXT`,`MEMO_ID`,`MEMO_HASH`,`MEMO_RETURN`]),ca=X.extend({family:J(Z.enum.stellar),fees:H().optional(),memoType:sa.optional(),memoValue:H().optional()}),la=Y([`send`,`delegate`,`undelegate`]),ua=X.extend({family:J(Z.enum.tezos),mode:la,fees:H().optional(),gasLimit:H().optional()}),da=K({isEncrypted:Xt(),text:H()}),fa=K({type:J(`jetton-transfer`),queryId:q([H(),W()]),amount:H(),destination:H(),responseDestination:H(),customPayload:q([H(),W()]),forwardAmount:H(),forwardPayload:q([H(),W()]),knownJetton:q([K({jettonId:U(),workchain:U()}),W()])}),pa=K({type:J(`nft-transfer`),queryId:q([H(),W()]),newOwner:H(),responseDestination:H(),customPayload:q([H(),W()]),forwardAmount:H(),forwardPayload:q([H(),W()])}),ma=q([K({type:J(`comment`),text:H()}),fa,pa,K({type:J(`unsafe`),message:H()}),K({type:J(`jetton-burn`),queryId:q([H(),W()]),amount:H(),responseDestination:H(),customPayload:q([H(),W()])}),K({type:J(`add-whitelist`),queryId:q([H(),W()]),address:H()}),K({type:J(`single-nominator-withdraw`),queryId:q([H(),W()]),amount:H()}),K({type:J(`single-nominator-change-validator`),queryId:q([H(),W()]),address:H()}),K({type:J(`tonstakers-deposit`),queryId:q([H(),W()]),appId:q([H(),W()])}),K({type:J(`vote-for-proposal`),queryId:q([H(),W()]),votingAddress:H(),expirationDate:U(),vote:Xt(),needConfirmation:Xt()}),K({type:J(`change-dns-record`),queryId:q([H(),W()]),record:q([K({type:J(`wallet`),value:q([K({address:H(),capabilities:q([K({isWallet:Xt()}),W()])}),W()])}),K({type:J(`unknown`),key:H(),value:q([H(),W()])})])}),K({type:J(`token-bridge-pay-swap`),queryId:q([H(),W()]),swapId:H()}),K({type:J(`tonwhales-pool-deposit`),queryId:H(),gasLimit:H()}),K({type:J(`tonwhales-pool-withdraw`),queryId:H(),gasLimit:H(),amount:H()}),K({type:J(`vesting-send-msg-comment`),queryId:q([H(),W()]),sendMode:U(),value:H(),destination:H(),text:H()})]),ha=X.extend({family:J(Z.enum.ton),fees:H(),comment:da,payload:ma.optional()}),ga=Y([`send`,`freeze`,`unfreeze`,`vote`,`claimReward`,`withdrawExpireUnfreeze`,`unDelegateResource`,`legacyUnfreeze`]),_a=Y([`BANDWIDTH`,`ENERGY`]),va=K({address:H(),voteCount:U()}),ya=X.extend({family:J(Z.enum.tron),mode:ga,resource:_a.optional(),duration:U().optional(),votes:G(va).optional()}),ba=X.extend({family:J(Z.enum.hedera),memo:H().max(100).optional()}),xa=X.extend({family:J(Z.enum.kaspa),customFeeRate:H().optional()}),Sa=X.extend({data:H().optional(),family:J(Z.enum.filecoin),gasLimit:U(),gasFeeCap:H(),gasPremium:H(),method:U(),nonce:U(),params:H().optional(),version:U()});Y([`send`,`delegate`,`reDelegateRewards`,`unDelegate`,`claimRewards`,`withdraw`]);var Ca=X.extend({family:J(Z.enum.elrond),mode:q([J(`send`),J(`delegate`),J(`reDelegateRewards`),J(`unDelegate`),J(`claimRewards`),J(`withdraw`)]),fees:H().optional(),data:H().optional(),gasLimit:U()}),wa=X.extend({family:J(Z.enum.cardano),fees:H().optional(),mode:H(),memo:H().optional()}),Ta=K({to:H().nullable(),value:q([H(),U()]),data:H(),comment:H().optional(),abi:H().optional()}),Ea=K({chainTag:U(),blockRef:H(),expiration:U(),clauses:G(Ta),gasPriceCoef:U().optional(),gas:q([H(),U()]),dependsOn:H().nullable(),nonce:q([H(),U()]),maxFeePerGas:q([H(),U()]).optional(),maxPriorityFeePerGas:q([H(),U()]).optional(),reserved:K({features:U().optional(),unused:G(Qt()).optional()}).optional()}),Da=tn(`family`,[Ui,Gi,Ki,Ji,Zi,Qi,$i,ba,xa,Sa,ea,ta,ia,aa,ca,ua,ha,ya,Ca,wa,oa,X.extend({family:J(Z.enum.vechain),estimatedFees:H(),body:Ea}),X.extend({family:J(Z.enum.stacks),fee:H().optional(),nonce:H().optional(),memo:H().optional(),network:H(),anchorMode:U()}),X.extend({family:J(Z.enum.internet_computer),fees:H(),memo:H().optional()}),X.extend({family:J(Z.enum.casper),fees:H(),transferId:H().optional()}),X.extend({family:J(Z.enum.sui),mode:H(),fees:H().optional()})]),Oa=class{prefix=``;constructor(e){this.prefix=e?`[${e}] `:``}log(e,...t){}warn(e,...t){}debug(e,...t){}error(e,...t){}},ka=new Oa(`WindowMessage`),Aa=class{target;logger;_onMessage;constructor(e=window,t=ka){this.target=e,this.logger=t}connect=()=>{this.target.addEventListener(`message`,this._onMessageEvent,!1),this.target.document?.addEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners registered`)};disconnect=()=>{this.target.removeEventListener(`message`,this._onMessageEvent,!1),this.target.document?.removeEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners unregistered`)};_onMessageEvent=e=>{if(this._onMessage)if(this.logger.debug(`received message event`,e),e.data&&typeof e.data==`string`)try{let t=e.data;Date.now()>0?(this.logger.log(`received message`,t),this._onMessage(t)):this.logger.debug(`not a wallet API message`)}catch(e){this.logger.warn(`parse error`),e instanceof Error&&this._onMessage(e.message)}else this.logger.debug(`ignoring message same origin`);else this.logger.debug(`no handler registered`)};set onMessage(e){this._onMessage=e}get onMessage(){return this._onMessage}send=e=>{try{return this.target.ReactNativeWebView?(this.logger.log(`sending message (ReactNativeWebview)`,e),this.target.ReactNativeWebView.postMessage(e)):this.target.ElectronWebview?(this.logger.log(`sending message (ElectronWebview)`,e),this.target.ElectronWebview.postMessage(e)):(this.logger.log(`sending message`,e),this.target.top?.postMessage(e,`*`)),Promise.resolve()}catch(e){return this.logger.error(`unexpected error on send`,e),Promise.reject(e)}}},ja;(function(e){e.Slow=`slow`,e.Medium=`medium`,e.Fast=`fast`})(ja||={});var Ma;(function(e){e.Blue=`blue`,e.NanoS=`nanoS`,e.NanoX=`nanoX`})(Ma||={});var Na;(function(e){e[e.SWAP=0]=`SWAP`,e[e.SELL=1]=`SELL`,e[e.FUND=2]=`FUND`})(Na||={});var Pa=Y([`NOT_IMPLEMENTED_BY_WALLET`,`ACCOUNT_NOT_FOUND`,`CURRENCY_NOT_FOUND`,`PERMISSION_DENIED`,`UNKNOWN_ERROR`,`UNAUTHORIZED_STORE`]),Fa=K({code:J(Pa.enum.NOT_IMPLEMENTED_BY_WALLET),message:H(),data:K({methodId:H()})}),Ia=K({code:J(Pa.enum.ACCOUNT_NOT_FOUND),message:H(),data:K({accountId:H()})}),La=K({code:J(Pa.enum.CURRENCY_NOT_FOUND),message:H(),data:K({currencyId:H()})}),Ra=K({code:J(Pa.enum.PERMISSION_DENIED),message:H(),data:K({methodId:H()})}),za=K({name:H().optional(),message:H().optional(),stack:H().optional(),cause:$t().optional(),code:H().optional()}),Ba=tn(`code`,[Fa,Ia,La,Ra,K({code:J(Pa.enum.UNKNOWN_ERROR),message:H(),data:za.passthrough()})]);function Va(e){return{code:`UNKNOWN_ERROR`,message:`an unhandled error was thrown`,data:e}}var Ha=class extends Error{errorData;constructor(e){super(e.message),this.errorData=e}getCode(){return this.errorData.code}getData(){return this.errorData}},Ua=class extends Error{err;constructor(e){super(e.message),this.err=e}getCode(){return this.err.code}getData(){return this.err.data}},Wa;(function(e){e[e.PARSE_ERROR=-32700]=`PARSE_ERROR`,e[e.INVALID_REQUEST=-32600]=`INVALID_REQUEST`,e[e.METHOD_NOT_FOUND=-32601]=`METHOD_NOT_FOUND`,e[e.INVALID_PARAMS=-32602]=`INVALID_PARAMS`,e[e.INTERNAL_ERROR=-32603]=`INTERNAL_ERROR`,e[e.SERVER_ERROR=-32e3]=`SERVER_ERROR`})(Wa||={});var Ga=q([H(),U(),W()]),Ka=K({jsonrpc:J(`2.0`),method:H(),params:Qt(),id:Ga.optional()}).strict(),qa=K({code:U(),message:H(),data:Qt().optional()}).strict(),Ja=K({jsonrpc:J(`2.0`),id:Ga,result:K({}).passthrough().optional()}).strict(),Ya=q([Ka,q([K({jsonrpc:J(`2.0`),id:Ga,error:qa}).strict(),Ja])]);function Xa(e){try{let t=JSON.parse(e);return Ya.parse(t)}catch(e){throw e instanceof SyntaxError?new Ua({code:Wa.PARSE_ERROR,message:`parse error`}):e instanceof Te?new Ua({code:Wa.INVALID_REQUEST,message:`invalid request`}):e}}function Za(e){return{jsonrpc:`2.0`,...e}}var Qa=class{transport;requestHandlers;ongoingRequests={};constructor(e,t){this.transport=e,this.requestHandlers=t,this.transport.onMessage=e=>{this.handleMessage(e)}}_request(e){return new Promise((t,n)=>{if(!e.id){n(Error(`requests need to have an id`));return}let r=e=>{if(`error`in e){if(e.error.code===Wa.SERVER_ERROR){let t=Ba.parse(e.error.data);if(t.code===`UNKNOWN_ERROR`){n(v(t.data));return}n(new Ha(t));return}n(new Ua(e.error));return}t(e.result)};this.ongoingRequests[e.id]=r,this.transport.send(JSON.stringify(e))})}_notify(e){this.transport.send(JSON.stringify(e))}request(e,t){let n=re();return this._request({id:n,jsonrpc:`2.0`,method:e,params:t})}notify(e,t){return this._notify({jsonrpc:`2.0`,method:e,params:t})}async handleRpcRequest(e){try{let t=await this.onRequest(e);if(e.id){let n=Za({id:e.id,result:t});this.transport.send(JSON.stringify(n))}}catch(e){if(e instanceof Te)throw new Ua({code:Wa.INVALID_PARAMS,message:e.message,data:e.flatten()});if(e instanceof Ha)throw new Ua({code:Wa.SERVER_ERROR,message:`unexpected server error`,data:e.getData()});if(e instanceof Ua)throw e;let t=_(e);throw t=typeof t==`string`||!t?{message:t}:t,new Ua({code:Wa.SERVER_ERROR,message:`unexpected server error`,data:Va(t)})}}async handleMessage(e){let t=!1,n;try{let r=Xa(e);n=r.id,`method`in r?await this.handleRpcRequest(r):(t=!0,this.handleRpcResponse(r))}catch(e){if(t)throw e;if(e instanceof Ua){let t=Za({id:n??null,error:{code:e.getCode(),message:e.message,data:e.getData()}});this.transport.send(JSON.stringify(t));return}throw e}}handleRpcResponse(e){if(!e.id)return;let t=this.ongoingRequests[e.id];if(!t)throw Error(`no ongoingRequest ${e.id}`);t(e)}},$a={params:K({currencyIds:G(H()).optional()}).optional(),result:K({rawAccounts:G(an)})},eo={params:K({accountId:H(),tokenCurrency:H().optional()}),result:K({address:H()})},to={params:K({currencyIds:G(H()).optional(),showAccountFilter:Xt().optional(),drawerConfiguration:K({assets:K({filter:H().optional(),leftElement:H().optional(),rightElement:H().optional()}).optional(),networks:K({leftElement:H().optional(),rightElement:H().optional()}).optional()}).optional(),useCase:H().optional(),uiUseCase:H().optional()}),result:K({rawAccount:an})},no={params:K({accountId:H(),derivationPath:H().optional()}),result:K({address:H()})},ro={params:K({accountId:H(),intentions:G(Y([`payment`,`ordinal`])).optional()}),result:K({addresses:G(K({address:H(),publicKey:H().optional(),path:H().optional(),intention:H().optional()}))})},io={params:K({accountId:H(),derivationPath:H().optional()}),result:K({publicKey:H()})},ao={params:K({accountId:H()}),result:K({xPub:H()})},oo={params:K({accountId:H(),psbt:H(),broadcast:Xt().optional()}),result:K({psbtSigned:H(),txHash:H().optional()})},so={params:K({currencyIds:G(H()).optional()}).optional(),result:K({currencies:G(ln)})},co=Y([`blue`,`nanoS`,`nanoSP`,`nanoX`,`stax`,`europa`,`apex`]),lo={params:K({transportId:H()}),result:K({transportId:H()})},uo={params:K({apduHex:H(),transportId:H()}),result:K({responseHex:H()})},fo={params:K({deviceId:H()}),result:K({transportId:H()})},po={params:K({appName:H().optional(),appVersionRange:H().optional(),firmwareVersionRange:H().optional(),seeded:Xt().optional(),devices:co.array().nonempty().optional()}),result:K({deviceId:H()})},mo={params:K({appName:H().optional(),appVersionRange:H().optional(),firmwareVersionRange:H().optional(),seeded:Xt().optional(),devices:co.array().nonempty().optional()}),result:K({transportId:H()})},ho=Y([`SLOW`,`MEDIUM`,`FAST`,`CUSTOM`]),go=K({provider:H(),fromAccountId:H(),rawTransaction:Da,hexBinaryPayload:H(),hexSignature:H(),feeStrategy:ho,tokenCurrency:H().optional()}),_o={params:tn(`exchangeType`,[go.extend({exchangeType:J(`FUND`)}),go.extend({exchangeType:J(`SELL`)}),go.extend({exchangeType:J(`SWAP`),toAccountId:H(),swapId:H(),rate:U()})]),result:K({transactionHash:H()})},vo={params:K({exchangeType:Y([`SWAP`,`SELL`,`FUND`,`SWAP_NG`,`SELL_NG`,`FUND_NG`])}),result:K({transactionId:H()})},yo=K({hwAppId:H().optional(),dependencies:G(H()).optional()}),bo={params:K({accountId:H(),hexMessage:H(),options:yo.optional(),meta:nn(H(),$t()).optional()}),result:K({hexSignedMessage:H()})},xo={params:K({key:H().min(1),storeId:H().min(1).optional()}),result:K({value:H().optional()})},So={params:K({key:H(),value:H(),storeId:H().optional()}),result:en().optional()},Co=K({hwAppId:H().optional(),dependencies:G(H()).optional()}),wo={params:K({accountId:H(),rawTransaction:Da,options:Co.optional(),meta:nn(H(),$t()).optional(),tokenCurrency:H().optional()}),result:K({signedTransactionHex:H()})},To=K({hwAppId:H().optional(),dependencies:G(H()).optional()}),Eo={params:K({accountId:H(),rawTransaction:Da,options:To.optional(),meta:nn(H(),$t()).optional(),tokenCurrency:H().optional()}),result:K({transactionHash:H()})},Do=K({hwAppId:H().optional(),dependencies:G(H()).optional()}),Oo={params:K({accountId:H(),rawTransaction:H(),broadcast:Xt().optional(),options:Do.optional(),meta:nn(H(),$t()).optional()}),result:K({signedTransactionHex:H(),transactionHash:H().optional()})},ko={params:K({}),result:K({methodIds:G(H())})},Ao={params:K({}),result:K({tracking:Xt(),wallet:K({name:H(),version:H()})})},jo={params:K({}),result:K({userId:H()})};Y([`account.list`,`account.receive`,`account.request`,`currency.list`,`device.close`,`device.exchange`,`device.transport`,`message.sign`,`transaction.sign`,`transaction.signRaw`,`transaction.signAndBroadcast`,`wallet.capabilities`,`wallet.info`,`wallet.userId`]),u();var Mo=class e extends y{walletApi;transportId;constructor(e,t){super(),this.transportId=t,this.walletApi=e}static isSupported=()=>Promise.resolve(!0);static list=()=>Promise.resolve([]);static listen=e=>({unsubscribe:()=>{}});static open({walletApi:t,transportId:n}){return Promise.resolve(new e(t,n))}async exchange(e){let t=e.toString(`hex`),n=await this.walletApi.request(`device.exchange`,{transportId:this.transportId,apduHex:t}),r=uo.result.parse(n);return d.from(r.responseHex,`hex`)}setScrambleKey(){}async close(){let e=await this.walletApi.request(`device.close`,{transportId:this.transportId});lo.result.parse(e)}},No=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`account.list`,{currencyIds:e?.currencyIds});return $a.result.parse(t).rawAccounts.map(Se)}async request(e){let t=await this.client.request(`account.request`,{currencyIds:e?.currencyIds,showAccountFilter:e?.showAccountFilter,drawerConfiguration:e?.drawerConfiguration,useCase:e?.useCase,uiUseCase:e?.uiUseCase});return Se(to.result.parse(t).rawAccount)}async receive(e){let t=await this.client.request(`account.receive`,{accountId:e});return eo.result.parse(t).address}},Po=class{client;constructor(e){this.client=e}async getAddress(e,t){let n=await this.client.request(`bitcoin.getAddress`,{accountId:e,derivationPath:t});return no.result.parse(n).address}async getAddresses(e,t){let n=await this.client.request(`bitcoin.getAddresses`,{accountId:e,intentions:t});return ro.result.parse(n).addresses}async getPublicKey(e,t){let n=await this.client.request(`bitcoin.getPublicKey`,{accountId:e,derivationPath:t});return io.result.parse(n).publicKey}async getXPub(e){let t=await this.client.request(`bitcoin.getXPub`,{accountId:e});return ao.result.parse(t).xPub}async signPsbt(e,t,n){let r=await this.client.request(`bitcoin.signPsbt`,{accountId:e,psbt:t,broadcast:n}),{psbtSigned:i,txHash:a}=oo.result.parse(r);return{psbtSigned:i,txHash:a}}},Fo=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`currency.list`,{currencyIds:e?.currencyIds});return so.result.parse(t).currencies}},Io=class{client;constructor(e){this.client=e}async transport(e){let t=await this.client.request(`device.transport`,e),n=mo.result.parse(t);return Mo.open({walletApi:this.client,transportId:n.transportId})}async open(e){let t=await this.client.request(`device.open`,e),n=fo.result.parse(t);return Mo.open({walletApi:this.client,transportId:n.transportId})}async select(e){let t=await this.client.request(`device.select`,e);return po.result.parse(t)}},Lo=class{client;constructor(e){this.client=e}async start(e){let t=await this.client.request(`exchange.start`,{exchangeType:e});return vo.result.parse(t).transactionId}async completeSwap({provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,transaction:a,binaryPayload:o,signature:s,feeStrategy:c,tokenCurrency:l}){let u=await this.client.request(`exchange.complete`,{exchangeType:`SWAP`,provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,rawTransaction:Bi(a),hexBinaryPayload:o.toString(`hex`),hexSignature:s.toString(`hex`),feeStrategy:c,tokenCurrency:l});return _o.result.parse(u).transactionHash}async completeSell({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a}){let o=await this.client.request(`exchange.complete`,{exchangeType:`SELL`,provider:e,fromAccountId:t,rawTransaction:Bi(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a});return _o.result.parse(o).transactionHash}async completeFund({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a,tokenCurrency:o}){let s=await this.client.request(`exchange.complete`,{exchangeType:`FUND`,provider:e,fromAccountId:t,rawTransaction:Bi(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a,tokenCurrency:o});return _o.result.parse(s).transactionHash}};u();var Ro=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`message.sign`,{accountId:e,hexMessage:t.toString(`hex`),options:n,meta:r}),a=bo.result.parse(i);return d.from(a.hexSignedMessage,`hex`)}},zo=class{client;constructor(e){this.client=e}async get(e,t){let n=await this.client.request(`storage.get`,{key:e,storeId:t});return xo.result.parse(n).value}async set(e,t,n){let r=await this.client.request(`storage.set`,{key:e,value:t,storeId:n});return So.result.parse(r)}};u();var Bo=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`transaction.sign`,{accountId:e,rawTransaction:Bi(t),options:n,meta:r}),a=wo.result.parse(i);return d.from(a.signedTransactionHex,`hex`)}async signRaw(e,t,n,r,i){let a=await this.client.request(`transaction.signRaw`,{accountId:e,rawTransaction:t,broadcast:n,options:r,meta:i});return Oo.result.parse(a)}async signAndBroadcast(e,t,n,r){let i=await this.client.request(`transaction.signAndBroadcast`,{accountId:e,rawTransaction:Bi(t),options:n,meta:r});return Eo.result.parse(i).transactionHash}},Vo=class{client;constructor(e){this.client=e}async userId(){let e=await this.client.request(`wallet.userId`,{});return jo.result.parse(e).userId}async info(){let e=await this.client.request(`wallet.info`,{});return Ao.result.parse(e)}async capabilities(){let e=await this.client.request(`wallet.capabilities`,{});return ko.result.parse(e).methodIds}},Ho=new Oa(`Wallet-API-Client`),Uo={"event.account.updated":e=>Promise.resolve()},Wo=class extends Qa{account;bitcoin;currency;device;message;storage;transaction;wallet;exchange;custom;logger;constructor(e,t=Ho,n,r={}){super(e,{...Uo,...r}),this.logger=t,this.account=new No(this),this.bitcoin=new Po(this),this.currency=new Fo(this),this.device=new Io(this),this.message=new Ro(this),this.storage=new zo(this),this.transaction=new Bo(this),this.wallet=new Vo(this),this.exchange=new Lo(this),this.custom=n?n(this):{}}setEventHandlers(e){this.requestHandlers={...Uo,...e}}onRequest(e){this.logger.log(e.method);let t=this.requestHandlers[e.method];if(!t)throw new Ua({code:Wa.METHOD_NOT_FOUND,message:`method not found`});return t(e)}},Go={near:{"*":{currencyId:`near`,family:`near`,skChainName:h.Near}},tezos:{"*":{currencyId:`tezos`,family:`tezos`,skChainName:h.Tezos}},solana:{"*":{currencyId:`solana`,family:`solana`,skChainName:h.Solana}},tron:{"*":{currencyId:`tron`,family:`tron`,skChainName:h.Tron}},ton:{"*":{currencyId:`ton`,family:`ton`,skChainName:h.Ton}},polkadot:{"*":{currencyId:`assethub_polkadot`,family:`polkadot`,skChainName:p.Polkadot}},celo:{"*":{currencyId:`celo`,family:`celo`,skChainName:m.Celo}},ethereum:{ethereum:{currencyId:`ethereum`,family:`ethereum`,skChainName:m.Ethereum},polygon:{currencyId:`polygon`,family:`ethereum`,skChainName:m.Polygon},arbitrum:{currencyId:`arbitrum`,family:`ethereum`,skChainName:m.Arbitrum},optimism:{currencyId:`optimism`,family:`ethereum`,skChainName:m.Optimism},avalanche_c_chain:{currencyId:`avalanche_c_chain`,family:`ethereum`,skChainName:m.AvalancheC},ethereum_hoodi:{currencyId:`ethereum_hoodi`,family:`ethereum`,skChainName:m.EthereumHoodi},bsc:{currencyId:`bsc`,family:`ethereum`,skChainName:m.Binance}},cosmos:{cosmos:{currencyId:`cosmos`,family:`cosmos`,skChainName:g.Cosmos},crypto_org:{currencyId:`crypto_org`,family:`cosmos`,skChainName:g.Cronos},osmo:{currencyId:`osmo`,family:`cosmos`,skChainName:g.Osmosis},coreum:{currencyId:`coreum`,family:`cosmos`,skChainName:g.Coreum},axelar:{currencyId:`axelar`,family:`cosmos`,skChainName:g.Axelar},stargaze:{currencyId:`stargaze`,family:`cosmos`,skChainName:g.Stargaze},secret_network:{currencyId:`secret_network`,family:`cosmos`,skChainName:g.Secret},umee:{currencyId:`umee`,family:`cosmos`,skChainName:g.Umee},desmos:{currencyId:`desmos`,family:`cosmos`,skChainName:g.Desmos},onomy:{currencyId:`onomy`,family:`cosmos`,skChainName:g.Onomy},quicksilver:{currencyId:`quicksilver`,family:`cosmos`,skChainName:g.Quicksilver},persistence:{currencyId:`persistence`,family:`cosmos`,skChainName:g.Persistence},dydx:{currencyId:`dydx`,family:`cosmos`,skChainName:g.Dydx},injective:{currencyId:`injective`,family:`cosmos`,skChainName:g.Injective},sei:{currencyId:`sei`,family:`cosmos`,skChainName:g.Sei},mantra:{currencyId:`mantra`,family:`cosmos`,skChainName:g.Mantra}}},Ko=new Map([[p.Polkadot,1],[m.AvalancheC,2],[h.Tron,3],[m.Binance,4],[g.Cronos,5],[m.Polygon,6]]);u();var qo=ae(),Jo=new Set([m.Polygon,m.Optimism,m.Arbitrum,m.AvalancheC,m.Core]),Yo=({network:e,tx:t,txMeta:n})=>{let r=Xo(t);if(r.isLeft())return r;if(C(e))return r.chain(t=>D.decode(t).mapLeft(String).map(t=>Zo({network:e,tx:t})));switch(e){case p.Polkadot:return r.chain(e=>x.decode(e).mapLeft(String).chain(e=>Qo({gasEstimate:as(n.gasEstimate),payload:e,txMeta:n})));case h.Tron:return r.chain(e=>S.decode(e).mapLeft(String).chain(()=>es(n)));case h.Near:return ts(n);case h.Tezos:return ns(n);case h.Ton:return r.chain(e=>ee.decode(e).mapLeft(String).chain(e=>rs(e,n)));default:return is(e)?$o(n):r.map(e=>e)}},Xo=e=>o.encase(()=>JSON.parse(e)).mapLeft(()=>`Failed to parse tx`),Zo=({network:e,tx:t})=>{let n={amount:(t.value??0n).toString(),recipient:t.to,family:`ethereum`,nonce:t.nonce,gasLimit:t.gasLimit.toString(),data:d.from(f(t.data)).toString(`hex`)};return t.maxFeePerGas&&t.maxPriorityFeePerGas&&!Jo.has(e)?(n.maxFeePerGas=t.maxFeePerGas.toString(),n.maxPriorityFeePerGas=t.maxPriorityFeePerGas.toString()):t.gasPrice&&(n.gasPrice=t.gasPrice.toString()),n},Qo=({gasEstimate:e,payload:t,txMeta:n})=>o.encase(()=>{let r=new oe;r.setMetadata(r.createType(`Metadata`,t.tx.metadataRpc));let i=r.createType(`Extrinsic`,{method:t.tx.method},{version:t.tx.version}).method.toHuman(),a=ds(i.args),o=ss(e),s=t.tx.address;return(()=>{switch(i.method){case`bond`:return{mode:`bond`,family:`polkadot`,amount:hs(a.value,n.amountRaw),recipient:s,fee:o.toString(),rewardDestination:gs(a.payee)};case`bondExtra`:return{mode:`bond`,family:`polkadot`,amount:hs(a.maxAdditional),recipient:s,fee:o.toString(),rewardDestination:`Stash`};case`unbond`:return{mode:`unbond`,family:`polkadot`,amount:hs(a.value,n.amountRaw),recipient:s,fee:o.toString()};case`nominate`:return{mode:`nominate`,family:`polkadot`,amount:`0`,recipient:s,fee:o.toString(),validators:ys(a.targets)};case`chill`:return{mode:`chill`,family:`polkadot`,amount:`0`,recipient:s,fee:o.toString()};case`rebond`:return{mode:`rebond`,family:`polkadot`,amount:hs(a.value,n.amountRaw),recipient:s,fee:o.toString()};case`withdrawUnbonded`:return{mode:`withdrawUnbonded`,family:`polkadot`,amount:hs(a.value,`0`),recipient:s,numOfSlashingSpans:Number(hs(a.numOfSlashingSpans,`0`)),fee:o.toString()};default:throw Error(`Unsupported Polkadot Ledger method: ${i.method}`)}})()}).mapLeft(e=>e instanceof Error?e.message:`Invalid Polkadot transaction`),$o=e=>{let t=e.rawArguments?.validatorAddress,r=cs(e.txType),a=os(e)??(ls(r)?new i(0):null);return!t||a===null?s(`Missing Cosmos Ledger arguments`):n({family:`cosmos`,mode:r,validators:[{address:t,amount:a.toString()}],amount:a.toString(),recipient:t,memo:`via StakeKit CID-1009`})},es=e=>{let t=os(e),r=e.rawArguments?.tronResource,i=e.rawArguments?.validatorAddress??e.rawArguments?.validatorAddresses?.[0];return(()=>{switch(e.txType){case`FREEZE_BANDWIDTH`:case`FREEZE_ENERGY`:return!t||!r?s(`Missing Tron freeze arguments`):n({amount:t.toString(),recipient:e.address??``,family:`tron`,mode:`freeze`,resource:r});case`VOTE`:{let n=e.rawArguments?.validatorAddresses;return!t||!n?.length?s(`Missing Tron vote arguments`):vs({txMeta:e,validatorAddresses:n}).map(n=>({amount:t.toString(),recipient:e.address??``,family:`tron`,mode:`vote`,votes:n}))}case`UNDELEGATE_BANDWIDTH`:case`UNDELEGATE_ENERGY`:return!t||!r||!i?s(`Missing Tron undelegate arguments`):n({amount:t.toString(),recipient:i,family:`tron`,mode:`unDelegateResource`,resource:r});case`UNFREEZE_LEGACY_BANDWIDTH`:case`UNFREEZE_LEGACY_ENERGY`:return n({amount:`0`,recipient:``,family:`tron`,mode:`legacyUnfreeze`,resource:r});case`UNFREEZE_BANDWIDTH`:case`UNFREEZE_ENERGY`:return!t||!r?s(`Missing Tron unfreeze arguments`):n({amount:t.toString(),recipient:e.address??``,family:`tron`,mode:`unfreeze`,resource:r});case`CLAIM_REWARDS`:return n({amount:`0`,recipient:e.address??``,family:`tron`,mode:`claimReward`});default:return s(`Unsupported Tron Ledger transaction type: ${e.txType}`)}})().map(e=>({...e,votes:e.votes??[]}))},ts=e=>{let t=e.rawArguments?.validatorAddress,r=os(e);return!t||!r?s(`Missing Near Ledger arguments`):n({amount:r.toString(),recipient:t,family:`near`,mode:us(e.txType),fees:ss(as(e.gasEstimate)).toString()})},ns=e=>{let t=as(e.gasEstimate),r=e.txType===`UNSTAKE`,i=r?``:e.rawArguments?.validatorAddress;return!r&&!i?s(`Missing Tezos Ledger validator`):n({family:`tezos`,mode:r?`undelegate`:`delegate`,amount:`0`,recipient:i??``,fees:ss(t).toString(),gasLimit:String(t?.gasLimit??0)})},rs=(e,t)=>{let r=as(t.gasEstimate);if(Array.isArray(e)){let t=e[0];return t?n({family:`ton`,amount:t.amount,recipient:t.address,fees:ss(r).toString(),comment:{text:t.payload,isEncrypted:!1}}):s(`Unsupported Ton Ledger transaction payload`)}return o.encase(()=>{let t=(0,qo.loadMessageRelaxed)(qo.Cell.fromBase64(e.message).beginParse()),n=t.info;return{family:`ton`,amount:n.value.coins.toString(),recipient:n.dest.toString(),fees:ss(r).toString(),comment:{text:t.body.toBoc().toString(`base64`),isEncrypted:!1}}}).mapLeft(()=>`Unsupported Ton Ledger transaction payload`)},is=e=>Object.values(g).includes(e),as=e=>e?o.encase(()=>JSON.parse(e)).orDefault(null):null,os=e=>{if(e.amountRaw)return new i(e.amountRaw);let t=e.rawArguments?.amount??e.amount,n=e.inputToken?.decimals;return!t||n===void 0?null:new i(t).multipliedBy(new i(10).pow(n))},ss=e=>!e?.amount||!e.token?new i(0):new i(e.amount).multipliedBy(new i(10).pow(e.token.decimals)),cs=e=>{switch(e){case`STAKE`:return`delegate`;case`UNSTAKE`:return`undelegate`;case`RESTAKE`:case`REBOND`:return`redelegate`;case`RESTAKE_REWARDS`:return`claimRewardCompound`;case`CLAIM_REWARDS`:return`claimReward`;default:return`delegate`}},ls=e=>e===`claimReward`||e===`claimRewardCompound`,us=e=>{switch(e){case`STAKE`:return`stake`;case`UNSTAKE`:return`unstake`;case`WITHDRAW`:case`CLAIM_UNSTAKED`:return`withdraw`;default:return`stake`}},ds=e=>e?Object.entries(e).reduce((e,[t,n])=>(e[ps(t)]=fs(n),e),{}):{},fs=e=>{if(Array.isArray(e))return e.map(fs);if(typeof e==`string`){let t=e.replace(/,/g,``);return ms(t)?t:e}return typeof e==`object`&&e?ds(e):e},ps=e=>e.includes(`-`)||e.includes(`_`)?e.toLowerCase().replace(/([-_][a-z])/g,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``)):e,ms=e=>/^-?\d+(\.\d+)?(e[+-]?\d+)?$/i.test(e.trim()),hs=(e,t=void 0)=>typeof e==`string`?e:typeof e==`number`||typeof e==`bigint`?e.toString():t||`0`,gs=e=>{if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`)return e.toString()},_s=e=>{let t=e.rawArguments?.amount??e.amount;if(t)return new i(t);let n=e.inputToken?.decimals;return!e.amountRaw||n===void 0?null:new i(e.amountRaw).dividedBy(new i(10).pow(n))},vs=({txMeta:e,validatorAddresses:t})=>{let r=_s(e);if(!r)return s(`Missing Tron vote arguments`);let a=t.length,o=r.dividedToIntegerBy(a),c=r.modulo(a).integerValue(i.ROUND_FLOOR);return!o.isFinite()||!c.isFinite()||o.isNegative()||c.isNegative()?s(`Invalid Tron vote count`):o.plus(1).gt(2**53-1)?s(`Tron vote count exceeds Ledger limits`):n(t.map((e,t)=>({address:e,voteCount:o.plus(+(t<c.toNumber())).toNumber()})))},ys=e=>Array.isArray(e)?e.flatMap(e=>{if(typeof e==`string`)return[e];if(typeof e==`object`&&e&&`Id`in e){let t=e.Id;return typeof t==`string`?[t]:[]}if(typeof e==`object`&&e&&`id`in e){let t=e.id;return typeof t==`string`?[t]:[]}return[]}):[],bs=({accounts:e,ledgerCurrencies:t,enabledChainsMap:n})=>{let{accountsFamilies:r,accountsCurrencies:i}=e.reduce((e,n)=>{let r=t.get(n.currency);return r&&(e.accountsFamilies.add(r),e.accountsCurrencies.add(n.currency)),e},{accountsFamilies:new Set,accountsCurrencies:new Set}),o=a(Go).reduce((e,[t,a])=>{let o=Object.keys(a).reduce((e,t)=>{let o=a[t],s=n.evm[o.skChainName]?.wagmiChain||n.cosmos[o.skChainName]?.wagmiChain||n.misc[o.skChainName]?.wagmiChain||n.substrate[o.skChainName]?.wagmiChain;return s?r.has(o.family)&&(t===`*`||i.has(o.currencyId))?{...e,[t]:{...o,chain:s,enabled:!0}}:Ko.has(o.skChainName)?{...e,[t]:{...o,chain:s,enabled:!1}}:e:e},{});return{...e,[t]:o}},{});return Object.keys(o).reduce((e,t)=>{let n=o[t],r=Object.keys(n).reduce((e,t)=>(e.set(t,n[t]),e),new Map);return e.set(t,r),e},new Map)},xs=e=>T(()=>e.currency.list({currencyIds:Object.values(Go).flatMap(e=>Object.values(e).map(e=>e.currencyId))})).map(e=>e.reduce((e,t)=>(t.type===`CryptoCurrency`?e.cryptoCurrency.set(t.id,t.family):e.tokenCurrency.push(t),e),{cryptoCurrency:new Map,tokenCurrency:[]})).map(e=>(e.tokenCurrency.forEach(t=>{let n=e.cryptoCurrency.get(t.parent);n&&e.cryptoCurrency.set(t.id,n)}),e.cryptoCurrency)).mapLeft(e=>Error(`could not get currencies`)),Ss=({walletDetailsParams:e,enabledChainsMap:n,queryParams:i})=>l(a=>{let o=new c([]),s=new c([]),l=new c(void 0),u=l.pipe(b(e=>e?.parentAccountId??e?.id)),d=[],f=new c([]),p=null,m=null,h=null,g=new Aa;g.connect();let _=new Wo(g),v=async e=>{a.emitter.emit(`message`,{type:`connecting`});let t=(await xs(_)).unsafeCoerce(),c=(await T(()=>_.account.list()).map(e=>({accounts:e,accountsMap:new Map(e.map(e=>[e.id,e]))})).map(e=>e.accounts.map(t=>t.parentAccountId?r.fromNullable(e.accountsMap.get(t.parentAccountId)).map(e=>({...t,currency:e.currency})).orDefault(t):t)).mapLeft(e=>Error(`could not get accounts`))).unsafeCoerce();d=c.filter(e=>!e.parentAccountId);let u=bs({ledgerCurrencies:t,accounts:d,enabledChainsMap:n});m=new Map([...u.values()].flatMap(e=>[...e.values()].map(e=>[e.chain.id,e.currencyId]))),h=u;let{enabled:g,disabled:v}=[...u.values()].reduce((e,t)=>(t.forEach(t=>{t.enabled?e.enabled.push(t.chain):e.disabled.push(t.chain)}),e),{enabled:[],disabled:[]});o.next([...g,...v]),s.next(v);let b=c.reduce((e,n)=>{let r=t.get(n.currency);if(!r)return e;let i=u.get(r);if(!r||!i)return e;let a=i.get(`*`)||i.get(n.currency);return a&&e.push({account:n,chainItem:a}),e},[]).sort((e,t)=>(Ko.get(e.chainItem.skChainName)||999)-(Ko.get(t.chainItem.skChainName)||999));if(!b.length){let t=r.fromNullable(u.get(`ethereum`)?.get(`ethereum`)).extractNullable();if(!t)throw Error(`Default chain not found`);return f.next([]),p=t,x([`N/A`]),S(t.chain.id.toString()),{accounts:e?.withCapabilities?[{address:`N/A`,capabilities:{}}]:[`N/A`],chainId:t.chain.id}}let C=r.fromNullable(i.accountId).chain(e=>r.encase(()=>{if(e.startsWith(`js:`)){let[,,,t]=e.split(`:`);return{type:`address`,address:t}}return{type:`accountId`,accountId:e}})).chain(e=>w.find(t=>e.type===`address`?t.account.address===e.address:t.account.id===e.accountId,b)).altLazy(()=>r.fromNullable(i.network).chain(e=>w.find(t=>t.chainItem.skChainName===e,b))).altLazy(()=>w.head(b)).toEither(Error(`Account not found`)).unsafeCoerce();return l.next(C.account),p=C.chainItem,f.next(y().unsafeCoerce()),x([C.account.address]),S(p.chain.id.toString()),{accounts:e?.withCapabilities?[{address:C.account.address,capabilities:{}}]:[C.account.address],chainId:p.chain.id}},y=()=>r.fromNullable(p).toEither(Error(`Current chain not found`)).map(e=>d.filter(t=>t.currency===e.currencyId)),x=e=>{e.length===0?a.emitter.emit(`disconnect`):a.emitter.emit(`change`,{accounts:e})},S=e=>{a.emitter.emit(`change`,{chainId:te(e)})},C=()=>{a.emitter.emit(`disconnect`)},ee=async()=>({}),E=async()=>t(),D=async()=>g.disconnect(),re=async()=>{let e=p?.chain.id;if(!e)throw Error(`Chain not found`);return e},ie=async()=>[l.value?.address],ae=e=>{l.next(e),x([e.address])},oe=e=>T.liftEither(r.fromNullable(m?.get(e.id)).toEither(Error(`Chain not found`))).chain(e=>T(()=>_.account.request({currencyIds:[e]})).mapLeft(e=>Error(`could not request account`))).chain(t=>(d.push(t),o.next([...o.value,e]),s.next(s.value.filter(t=>t.id!==e.id)),T(()=>se({chainId:e.id})))).mapLeft(e=>Error(`failed to switch to new chain`)),se=async({chainId:e})=>{let t=p;if(!t||!h)throw Error(`Chain not found`);let n=[...h.values()].flatMap(e=>[...e.values()]).find(t=>t.chain.id===e);if(!n)throw Error(`Chain not found`);if(t.chain.id!==n.chain.id||!l.value){p=n;let e=y().unsafeCoerce();f.next(e),l.next(e[0])}let r=l.value;if(!r)throw Error(`Account not found`);return S(e.toString()),x([r.address]),n.chain};return{...e,id:ne.id,name:ne.name,type:ne.type,connect:v,onAccountsChanged:x,onChainChanged:S,onDisconnect:C,getProvider:ee,isAuthorized:E,getChainId:re,disconnect:D,switchChain:se,getAccounts:ie,switchAccount:ae,requestAndSwitchAccount:oe,walletApiClient:_,$accountsOnCurrentChain:f,$filteredChains:o.asObservable(),$currentAccountId:u,$disabledChains:s.asObservable(),noAccountPlaceholder:`N/A`,deserializeTransaction:Vi,prepareTransaction:Yo}}),Cs=({enabledChainsMap:e,queryParams:n})=>({groupName:`Ledger Live`,wallets:[()=>({id:ne.id,name:ne.name,iconUrl:E.ledgerLogo,iconBackground:`#fff`,chainGroup:{id:ne.id,title:ne.name,iconUrl:E.ledgerLogo},hidden:()=>!t(),createConnector:t=>Ss({walletDetailsParams:t,enabledChainsMap:e,queryParams:n})})]});export{Cs as ledgerLiveConnector};