UNPKG

@signumjs/wallets

Version:

Wallets communication package for DApps in the Signum Network

1 lines 62.7 kB
"use strict";var sig$wallets=(()=>{var On=Object.create;var We=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var Mn=Object.getPrototypeOf,Dn=Object.prototype.hasOwnProperty;var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Bn=(t,e)=>{for(var r in e)We(t,r,{get:e[r],enumerable:!0})},mr=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of Cn(e))!Dn.call(t,d)&&d!==r&&We(t,d,{get:()=>e[d],enumerable:!(s=Nn(e,d))||s.enumerable});return t};var yr=(t,e,r)=>(r=t!=null?On(Mn(t)):{},mr(e||!t||!t.__esModule?We(r,"default",{value:t,enumerable:!0}):r,t)),Tn=t=>mr(We({},"__esModule",{value:!0}),t);var wr=A(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.asyncRetry=vr;async function vr(t){let{asyncFn:e,onFailureAsync:r,retryCount:s=1,maxRetrials:d=20}=t;try{return await e()}catch(w){if(s>d)throw w;if(await r(w,s))await vr({asyncFn:e,onFailureAsync:r,retryCount:s+1});else throw w}}});var xr=A(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ChainTime=void 0;var _r=Date.UTC(2014,7,11,2,0,0,0)/1e3,Ft=class t{_chainTimestamp;constructor(e){this._chainTimestamp=e}static fromChainTimestamp(e){return new t(e)}static fromDate(e){let r=new t(0);return r.setDate(e),r}getChainTimestamp(){return this._chainTimestamp}setChainTimestamp(e){this._chainTimestamp=e}getEpoch(){return(_r+this._chainTimestamp)*1e3}getDate(){return new Date(this.getEpoch())}setDate(e){this._chainTimestamp=Math.round(e.getTime()/1e3)-_r}equals(e){return this._chainTimestamp===e._chainTimestamp}before(e){return this._chainTimestamp<e._chainTimestamp}after(e){return this._chainTimestamp>e._chainTimestamp}};Xe.ChainTime=Ft});var Be=A((Er,Ze)=>{(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,d=Math.floor,w="[BigNumber Error] ",S=w+"Number primitive has more than 15 significant digits: ",_=1e14,v=14,R=9007199254740991,G=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],j=1e7,B=1e9;function ge(O){var N,U,H,x=a.prototype={constructor:a,toString:null,valueOf:null},$=new a(1),T=20,F=4,ee=-7,se=21,me=-1e7,oe=1e7,we=!1,Se=1,de=0,De={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},_e="0123456789abcdefghijklmnopqrstuvwxyz",xe=!0;function a(n,i){var o,h,u,f,m,c,l,g,p=this;if(!(p instanceof a))return new a(n,i);if(i==null){if(n&&n._isBigNumber===!0){p.s=n.s,!n.c||n.e>oe?p.c=p.e=null:n.e<me?p.c=[p.e=0]:(p.e=n.e,p.c=n.c.slice());return}if((c=typeof n=="number")&&n*0==0){if(p.s=1/n<0?(n=-n,-1):1,n===~~n){for(f=0,m=n;m>=10;m/=10,f++);f>oe?p.c=p.e=null:(p.e=f,p.c=[n]);return}g=String(n)}else{if(!r.test(g=String(n)))return H(p,g,c);p.s=g.charCodeAt(0)==45?(g=g.slice(1),-1):1}(f=g.indexOf("."))>-1&&(g=g.replace(".","")),(m=g.search(/e/i))>0?(f<0&&(f=m),f+=+g.slice(m+1),g=g.substring(0,m)):f<0&&(f=g.length)}else{if(D(i,2,_e.length,"Base"),i==10&&xe)return p=new a(n),X(p,T+p.e+1,F);if(g=String(n),c=typeof n=="number"){if(n*0!=0)return H(p,g,c,i);if(p.s=1/n<0?(g=g.slice(1),-1):1,a.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(S+n)}else p.s=g.charCodeAt(0)===45?(g=g.slice(1),-1):1;for(o=_e.slice(0,i),f=m=0,l=g.length;m<l;m++)if(o.indexOf(h=g.charAt(m))<0){if(h=="."){if(m>f){f=l;continue}}else if(!u&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){u=!0,m=-1,f=0;continue}return H(p,String(n),c,i)}c=!1,g=U(g,i,10,p.s),(f=g.indexOf("."))>-1?g=g.replace(".",""):f=g.length}for(m=0;g.charCodeAt(m)===48;m++);for(l=g.length;g.charCodeAt(--l)===48;);if(g=g.slice(m,++l)){if(l-=m,c&&a.DEBUG&&l>15&&(n>R||n!==d(n)))throw Error(S+p.s*n);if((f=f-m-1)>oe)p.c=p.e=null;else if(f<me)p.c=[p.e=0];else{if(p.e=f,p.c=[],m=(f+1)%v,f<0&&(m+=v),m<l){for(m&&p.c.push(+g.slice(0,m)),l-=v;m<l;)p.c.push(+g.slice(m,m+=v));m=v-(g=g.slice(m)).length}else m-=l;for(;m--;g+="0");p.c.push(+g)}}else p.c=[p.e=0]}a.clone=ge,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=function(n){var i,o;if(n!=null)if(typeof n=="object"){if(n.hasOwnProperty(i="DECIMAL_PLACES")&&(o=n[i],D(o,0,B,i),T=o),n.hasOwnProperty(i="ROUNDING_MODE")&&(o=n[i],D(o,0,8,i),F=o),n.hasOwnProperty(i="EXPONENTIAL_AT")&&(o=n[i],o&&o.pop?(D(o[0],-B,0,i),D(o[1],0,B,i),ee=o[0],se=o[1]):(D(o,-B,B,i),ee=-(se=o<0?-o:o))),n.hasOwnProperty(i="RANGE"))if(o=n[i],o&&o.pop)D(o[0],-B,-1,i),D(o[1],1,B,i),me=o[0],oe=o[1];else if(D(o,-B,B,i),o)me=-(oe=o<0?-o:o);else throw Error(w+i+" cannot be zero: "+o);if(n.hasOwnProperty(i="CRYPTO"))if(o=n[i],o===!!o)if(o)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))we=o;else throw we=!o,Error(w+"crypto unavailable");else we=o;else throw Error(w+i+" not true or false: "+o);if(n.hasOwnProperty(i="MODULO_MODE")&&(o=n[i],D(o,0,9,i),Se=o),n.hasOwnProperty(i="POW_PRECISION")&&(o=n[i],D(o,0,B,i),de=o),n.hasOwnProperty(i="FORMAT"))if(o=n[i],typeof o=="object")De=o;else throw Error(w+i+" not an object: "+o);if(n.hasOwnProperty(i="ALPHABET"))if(o=n[i],typeof o=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(o))xe=o.slice(0,10)=="0123456789",_e=o;else throw Error(w+i+" invalid: "+o)}else throw Error(w+"Object expected: "+n);return{DECIMAL_PLACES:T,ROUNDING_MODE:F,EXPONENTIAL_AT:[ee,se],RANGE:[me,oe],CRYPTO:we,MODULO_MODE:Se,POW_PRECISION:de,FORMAT:De,ALPHABET:_e}},a.isBigNumber=function(n){if(!n||n._isBigNumber!==!0)return!1;if(!a.DEBUG)return!0;var i,o,h=n.c,u=n.e,f=n.s;e:if({}.toString.call(h)=="[object Array]"){if((f===1||f===-1)&&u>=-B&&u<=B&&u===d(u)){if(h[0]===0){if(u===0&&h.length===1)return!0;break e}if(i=(u+1)%v,i<1&&(i+=v),String(h[0]).length==i){for(i=0;i<h.length;i++)if(o=h[i],o<0||o>=_||o!==d(o))break e;if(o!==0)return!0}}}else if(h===null&&u===null&&(f===null||f===1||f===-1))return!0;throw Error(w+"Invalid BigNumber: "+n)},a.maximum=a.max=function(){return W(arguments,-1)},a.minimum=a.min=function(){return W(arguments,1)},a.random=function(){var n=9007199254740992,i=Math.random()*n&2097151?function(){return d(Math.random()*n)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(o){var h,u,f,m,c,l=0,g=[],p=new a($);if(o==null?o=T:D(o,0,B),m=s(o/v),we)if(crypto.getRandomValues){for(h=crypto.getRandomValues(new Uint32Array(m*=2));l<m;)c=h[l]*131072+(h[l+1]>>>11),c>=9e15?(u=crypto.getRandomValues(new Uint32Array(2)),h[l]=u[0],h[l+1]=u[1]):(g.push(c%1e14),l+=2);l=m/2}else if(crypto.randomBytes){for(h=crypto.randomBytes(m*=7);l<m;)c=(h[l]&31)*281474976710656+h[l+1]*1099511627776+h[l+2]*4294967296+h[l+3]*16777216+(h[l+4]<<16)+(h[l+5]<<8)+h[l+6],c>=9e15?crypto.randomBytes(7).copy(h,l):(g.push(c%1e14),l+=7);l=m/7}else throw we=!1,Error(w+"crypto unavailable");if(!we)for(;l<m;)c=i(),c<9e15&&(g[l++]=c%1e14);for(m=g[--l],o%=v,m&&o&&(c=G[v-o],g[l]=d(m/c)*c);g[l]===0;g.pop(),l--);if(l<0)g=[f=0];else{for(f=-1;g[0]===0;g.splice(0,1),f-=v);for(l=1,c=g[0];c>=10;c/=10,l++);l<v&&(f-=v-l)}return p.e=f,p.c=g,p}}(),a.sum=function(){for(var n=1,i=arguments,o=new a(i[0]);n<i.length;)o=o.plus(i[n++]);return o},U=function(){var n="0123456789";function i(o,h,u,f){for(var m,c=[0],l,g=0,p=o.length;g<p;){for(l=c.length;l--;c[l]*=h);for(c[0]+=f.indexOf(o.charAt(g++)),m=0;m<c.length;m++)c[m]>u-1&&(c[m+1]==null&&(c[m+1]=0),c[m+1]+=c[m]/u|0,c[m]%=u)}return c.reverse()}return function(o,h,u,f,m){var c,l,g,p,y,b,P,M,k=o.indexOf("."),Q=T,C=F;for(k>=0&&(p=de,de=0,o=o.replace(".",""),M=new a(h),b=M.pow(o.length-k),de=p,M.c=i(le(L(b.c),b.e,"0"),10,u,n),M.e=M.c.length),P=i(o,h,u,m?(c=_e,n):(c=n,_e)),g=p=P.length;P[--p]==0;P.pop());if(!P[0])return c.charAt(0);if(k<0?--g:(b.c=P,b.e=g,b.s=f,b=N(b,M,Q,C,u),P=b.c,y=b.r,g=b.e),l=g+Q+1,k=P[l],p=u/2,y=y||l<0||P[l+1]!=null,y=C<4?(k!=null||y)&&(C==0||C==(b.s<0?3:2)):k>p||k==p&&(C==4||y||C==6&&P[l-1]&1||C==(b.s<0?8:7)),l<1||!P[0])o=y?le(c.charAt(1),-Q,c.charAt(0)):c.charAt(0);else{if(P.length=l,y)for(--u;++P[--l]>u;)P[l]=0,l||(++g,P=[1].concat(P));for(p=P.length;!P[--p];);for(k=0,o="";k<=p;o+=c.charAt(P[k++]));o=le(o,g,c.charAt(0))}return o}}(),N=function(){function n(h,u,f){var m,c,l,g,p=0,y=h.length,b=u%j,P=u/j|0;for(h=h.slice();y--;)l=h[y]%j,g=h[y]/j|0,m=P*l+g*b,c=b*l+m%j*j+p,p=(c/f|0)+(m/j|0)+P*g,h[y]=c%f;return p&&(h=[p].concat(h)),h}function i(h,u,f,m){var c,l;if(f!=m)l=f>m?1:-1;else for(c=l=0;c<f;c++)if(h[c]!=u[c]){l=h[c]>u[c]?1:-1;break}return l}function o(h,u,f,m){for(var c=0;f--;)h[f]-=c,c=h[f]<u[f]?1:0,h[f]=c*m+h[f]-u[f];for(;!h[0]&&h.length>1;h.splice(0,1));}return function(h,u,f,m,c){var l,g,p,y,b,P,M,k,Q,C,I,ne,Ve,It,qt,ye,Le,fe=h.s==u.s?1:-1,ae=h.c,z=u.c;if(!ae||!ae[0]||!z||!z[0])return new a(!h.s||!u.s||(ae?z&&ae[0]==z[0]:!z)?NaN:ae&&ae[0]==0||!z?fe*0:fe/0);for(k=new a(fe),Q=k.c=[],g=h.e-u.e,fe=f+g+1,c||(c=_,g=K(h.e/v)-K(u.e/v),fe=fe/v|0),p=0;z[p]==(ae[p]||0);p++);if(z[p]>(ae[p]||0)&&g--,fe<0)Q.push(1),y=!0;else{for(It=ae.length,ye=z.length,p=0,fe+=2,b=d(c/(z[0]+1)),b>1&&(z=n(z,b,c),ae=n(ae,b,c),ye=z.length,It=ae.length),Ve=ye,C=ae.slice(0,ye),I=C.length;I<ye;C[I++]=0);Le=z.slice(),Le=[0].concat(Le),qt=z[0],z[1]>=c/2&&qt++;do{if(b=0,l=i(z,C,ye,I),l<0){if(ne=C[0],ye!=I&&(ne=ne*c+(C[1]||0)),b=d(ne/qt),b>1)for(b>=c&&(b=c-1),P=n(z,b,c),M=P.length,I=C.length;i(P,C,M,I)==1;)b--,o(P,ye<M?Le:z,M,c),M=P.length,l=1;else b==0&&(l=b=1),P=z.slice(),M=P.length;if(M<I&&(P=[0].concat(P)),o(C,P,I,c),I=C.length,l==-1)for(;i(z,C,ye,I)<1;)b++,o(C,ye<I?Le:z,I,c),I=C.length}else l===0&&(b++,C=[0]);Q[p++]=b,C[0]?C[I++]=ae[Ve]||0:(C=[ae[Ve]],I=1)}while((Ve++<It||C[0]!=null)&&fe--);y=C[0]!=null,Q[0]||Q.splice(0,1)}if(c==_){for(p=1,fe=Q[0];fe>=10;fe/=10,p++);X(k,f+(k.e=p+g*v-1)+1,m,y)}else k.e=g,k.r=+y;return k}}();function E(n,i,o,h){var u,f,m,c,l;if(o==null?o=F:D(o,0,8),!n.c)return n.toString();if(u=n.c[0],m=n.e,i==null)l=L(n.c),l=h==1||h==2&&(m<=ee||m>=se)?Re(l,m):le(l,m,"0");else if(n=X(new a(n),i,o),f=n.e,l=L(n.c),c=l.length,h==1||h==2&&(i<=f||f<=ee)){for(;c<i;l+="0",c++);l=Re(l,f)}else if(i-=m,l=le(l,f,"0"),f+1>c){if(--i>0)for(l+=".";i--;l+="0");}else if(i+=f-c,i>0)for(f+1==c&&(l+=".");i--;l+="0");return n.s<0&&u?"-"+l:l}function W(n,i){for(var o,h,u=1,f=new a(n[0]);u<n.length;u++)h=new a(n[u]),(!h.s||(o=Y(f,h))===i||o===0&&f.s===i)&&(f=h);return f}function re(n,i,o){for(var h=1,u=i.length;!i[--u];i.pop());for(u=i[0];u>=10;u/=10,h++);return(o=h+o*v-1)>oe?n.c=n.e=null:o<me?n.c=[n.e=0]:(n.e=o,n.c=i),n}H=function(){var n=/^(-?)0([xbo])(?=\w[\w.]*$)/i,i=/^([^.]+)\.$/,o=/^\.([^.]+)$/,h=/^-?(Infinity|NaN)$/,u=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(f,m,c,l){var g,p=c?m:m.replace(u,"");if(h.test(p))f.s=isNaN(p)?null:p<0?-1:1;else{if(!c&&(p=p.replace(n,function(y,b,P){return g=(P=P.toLowerCase())=="x"?16:P=="b"?2:8,!l||l==g?b:y}),l&&(g=l,p=p.replace(i,"$1").replace(o,"0.$1")),m!=p))return new a(p,g);if(a.DEBUG)throw Error(w+"Not a"+(l?" base "+l:"")+" number: "+m);f.s=null}f.c=f.e=null}}();function X(n,i,o,h){var u,f,m,c,l,g,p,y=n.c,b=G;if(y){e:{for(u=1,c=y[0];c>=10;c/=10,u++);if(f=i-u,f<0)f+=v,m=i,l=y[g=0],p=d(l/b[u-m-1]%10);else if(g=s((f+1)/v),g>=y.length)if(h){for(;y.length<=g;y.push(0));l=p=0,u=1,f%=v,m=f-v+1}else break e;else{for(l=c=y[g],u=1;c>=10;c/=10,u++);f%=v,m=f-v+u,p=m<0?0:d(l/b[u-m-1]%10)}if(h=h||i<0||y[g+1]!=null||(m<0?l:l%b[u-m-1]),h=o<4?(p||h)&&(o==0||o==(n.s<0?3:2)):p>5||p==5&&(o==4||h||o==6&&(f>0?m>0?l/b[u-m]:0:y[g-1])%10&1||o==(n.s<0?8:7)),i<1||!y[0])return y.length=0,h?(i-=n.e+1,y[0]=b[(v-i%v)%v],n.e=-i||0):y[0]=n.e=0,n;if(f==0?(y.length=g,c=1,g--):(y.length=g+1,c=b[v-f],y[g]=m>0?d(l/b[u-m]%b[m])*c:0),h)for(;;)if(g==0){for(f=1,m=y[0];m>=10;m/=10,f++);for(m=y[0]+=c,c=1;m>=10;m/=10,c++);f!=c&&(n.e++,y[0]==_&&(y[0]=1));break}else{if(y[g]+=c,y[g]!=_)break;y[g--]=0,c=1}for(f=y.length;y[--f]===0;y.pop());}n.e>oe?n.c=n.e=null:n.e<me&&(n.c=[n.e=0])}return n}function Z(n){var i,o=n.e;return o===null?n.toString():(i=L(n.c),i=o<=ee||o>=se?Re(i,o):le(i,o,"0"),n.s<0?"-"+i:i)}return x.absoluteValue=x.abs=function(){var n=new a(this);return n.s<0&&(n.s=1),n},x.comparedTo=function(n,i){return Y(this,new a(n,i))},x.decimalPlaces=x.dp=function(n,i){var o,h,u,f=this;if(n!=null)return D(n,0,B),i==null?i=F:D(i,0,8),X(new a(f),n+f.e+1,i);if(!(o=f.c))return null;if(h=((u=o.length-1)-K(this.e/v))*v,u=o[u])for(;u%10==0;u/=10,h--);return h<0&&(h=0),h},x.dividedBy=x.div=function(n,i){return N(this,new a(n,i),T,F)},x.dividedToIntegerBy=x.idiv=function(n,i){return N(this,new a(n,i),0,1)},x.exponentiatedBy=x.pow=function(n,i){var o,h,u,f,m,c,l,g,p,y=this;if(n=new a(n),n.c&&!n.isInteger())throw Error(w+"Exponent not an integer: "+Z(n));if(i!=null&&(i=new a(i)),c=n.e>14,!y.c||!y.c[0]||y.c[0]==1&&!y.e&&y.c.length==1||!n.c||!n.c[0])return p=new a(Math.pow(+Z(y),c?n.s*(2-Me(n)):+Z(n))),i?p.mod(i):p;if(l=n.s<0,i){if(i.c?!i.c[0]:!i.s)return new a(NaN);h=!l&&y.isInteger()&&i.isInteger(),h&&(y=y.mod(i))}else{if(n.e>9&&(y.e>0||y.e<-1||(y.e==0?y.c[0]>1||c&&y.c[1]>=24e7:y.c[0]<8e13||c&&y.c[0]<=9999975e7)))return f=y.s<0&&Me(n)?-0:0,y.e>-1&&(f=1/f),new a(l?1/f:f);de&&(f=s(de/v+2))}for(c?(o=new a(.5),l&&(n.s=1),g=Me(n)):(u=Math.abs(+Z(n)),g=u%2),p=new a($);;){if(g){if(p=p.times(y),!p.c)break;f?p.c.length>f&&(p.c.length=f):h&&(p=p.mod(i))}if(u){if(u=d(u/2),u===0)break;g=u%2}else if(n=n.times(o),X(n,n.e+1,1),n.e>14)g=Me(n);else{if(u=+Z(n),u===0)break;g=u%2}y=y.times(y),f?y.c&&y.c.length>f&&(y.c.length=f):h&&(y=y.mod(i))}return h?p:(l&&(p=$.div(p)),i?p.mod(i):f?X(p,de,F,m):p)},x.integerValue=function(n){var i=new a(this);return n==null?n=F:D(n,0,8),X(i,i.e+1,n)},x.isEqualTo=x.eq=function(n,i){return Y(this,new a(n,i))===0},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(n,i){return Y(this,new a(n,i))>0},x.isGreaterThanOrEqualTo=x.gte=function(n,i){return(i=Y(this,new a(n,i)))===1||i===0},x.isInteger=function(){return!!this.c&&K(this.e/v)>this.c.length-2},x.isLessThan=x.lt=function(n,i){return Y(this,new a(n,i))<0},x.isLessThanOrEqualTo=x.lte=function(n,i){return(i=Y(this,new a(n,i)))===-1||i===0},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&this.c[0]==0},x.minus=function(n,i){var o,h,u,f,m=this,c=m.s;if(n=new a(n,i),i=n.s,!c||!i)return new a(NaN);if(c!=i)return n.s=-i,m.plus(n);var l=m.e/v,g=n.e/v,p=m.c,y=n.c;if(!l||!g){if(!p||!y)return p?(n.s=-i,n):new a(y?m:NaN);if(!p[0]||!y[0])return y[0]?(n.s=-i,n):new a(p[0]?m:F==3?-0:0)}if(l=K(l),g=K(g),p=p.slice(),c=l-g){for((f=c<0)?(c=-c,u=p):(g=l,u=y),u.reverse(),i=c;i--;u.push(0));u.reverse()}else for(h=(f=(c=p.length)<(i=y.length))?c:i,c=i=0;i<h;i++)if(p[i]!=y[i]){f=p[i]<y[i];break}if(f&&(u=p,p=y,y=u,n.s=-n.s),i=(h=y.length)-(o=p.length),i>0)for(;i--;p[o++]=0);for(i=_-1;h>c;){if(p[--h]<y[h]){for(o=h;o&&!p[--o];p[o]=i);--p[o],p[h]+=_}p[h]-=y[h]}for(;p[0]==0;p.splice(0,1),--g);return p[0]?re(n,p,g):(n.s=F==3?-1:1,n.c=[n.e=0],n)},x.modulo=x.mod=function(n,i){var o,h,u=this;return n=new a(n,i),!u.c||!n.s||n.c&&!n.c[0]?new a(NaN):!n.c||u.c&&!u.c[0]?new a(u):(Se==9?(h=n.s,n.s=1,o=N(u,n,0,3),n.s=h,o.s*=h):o=N(u,n,0,Se),n=u.minus(o.times(n)),!n.c[0]&&Se==1&&(n.s=u.s),n)},x.multipliedBy=x.times=function(n,i){var o,h,u,f,m,c,l,g,p,y,b,P,M,k,Q,C=this,I=C.c,ne=(n=new a(n,i)).c;if(!I||!ne||!I[0]||!ne[0])return!C.s||!n.s||I&&!I[0]&&!ne||ne&&!ne[0]&&!I?n.c=n.e=n.s=null:(n.s*=C.s,!I||!ne?n.c=n.e=null:(n.c=[0],n.e=0)),n;for(h=K(C.e/v)+K(n.e/v),n.s*=C.s,l=I.length,y=ne.length,l<y&&(M=I,I=ne,ne=M,u=l,l=y,y=u),u=l+y,M=[];u--;M.push(0));for(k=_,Q=j,u=y;--u>=0;){for(o=0,b=ne[u]%Q,P=ne[u]/Q|0,m=l,f=u+m;f>u;)g=I[--m]%Q,p=I[m]/Q|0,c=P*g+p*b,g=b*g+c%Q*Q+M[f]+o,o=(g/k|0)+(c/Q|0)+P*p,M[f--]=g%k;M[f]=o}return o?++h:M.splice(0,1),re(n,M,h)},x.negated=function(){var n=new a(this);return n.s=-n.s||null,n},x.plus=function(n,i){var o,h=this,u=h.s;if(n=new a(n,i),i=n.s,!u||!i)return new a(NaN);if(u!=i)return n.s=-i,h.minus(n);var f=h.e/v,m=n.e/v,c=h.c,l=n.c;if(!f||!m){if(!c||!l)return new a(u/0);if(!c[0]||!l[0])return l[0]?n:new a(c[0]?h:u*0)}if(f=K(f),m=K(m),c=c.slice(),u=f-m){for(u>0?(m=f,o=l):(u=-u,o=c),o.reverse();u--;o.push(0));o.reverse()}for(u=c.length,i=l.length,u-i<0&&(o=l,l=c,c=o,i=u),u=0;i;)u=(c[--i]=c[i]+l[i]+u)/_|0,c[i]=_===c[i]?0:c[i]%_;return u&&(c=[u].concat(c),++m),re(n,c,m)},x.precision=x.sd=function(n,i){var o,h,u,f=this;if(n!=null&&n!==!!n)return D(n,1,B),i==null?i=F:D(i,0,8),X(new a(f),n,i);if(!(o=f.c))return null;if(u=o.length-1,h=u*v+1,u=o[u]){for(;u%10==0;u/=10,h--);for(u=o[0];u>=10;u/=10,h++);}return n&&f.e+1>h&&(h=f.e+1),h},x.shiftedBy=function(n){return D(n,-R,R),this.times("1e"+n)},x.squareRoot=x.sqrt=function(){var n,i,o,h,u,f=this,m=f.c,c=f.s,l=f.e,g=T+4,p=new a("0.5");if(c!==1||!m||!m[0])return new a(!c||c<0&&(!m||m[0])?NaN:m?f:1/0);if(c=Math.sqrt(+Z(f)),c==0||c==1/0?(i=L(m),(i.length+l)%2==0&&(i+="0"),c=Math.sqrt(+i),l=K((l+1)/2)-(l<0||l%2),c==1/0?i="5e"+l:(i=c.toExponential(),i=i.slice(0,i.indexOf("e")+1)+l),o=new a(i)):o=new a(c+""),o.c[0]){for(l=o.e,c=l+g,c<3&&(c=0);;)if(u=o,o=p.times(u.plus(N(f,u,g,1))),L(u.c).slice(0,c)===(i=L(o.c)).slice(0,c))if(o.e<l&&--c,i=i.slice(c-3,c+1),i=="9999"||!h&&i=="4999"){if(!h&&(X(u,u.e+T+2,0),u.times(u).eq(f))){o=u;break}g+=4,c+=4,h=1}else{(!+i||!+i.slice(1)&&i.charAt(0)=="5")&&(X(o,o.e+T+2,1),n=!o.times(o).eq(f));break}}return X(o,o.e+T+1,F,n)},x.toExponential=function(n,i){return n!=null&&(D(n,0,B),n++),E(this,n,i,1)},x.toFixed=function(n,i){return n!=null&&(D(n,0,B),n=n+this.e+1),E(this,n,i)},x.toFormat=function(n,i,o){var h,u=this;if(o==null)n!=null&&i&&typeof i=="object"?(o=i,i=null):n&&typeof n=="object"?(o=n,n=i=null):o=De;else if(typeof o!="object")throw Error(w+"Argument not an object: "+o);if(h=u.toFixed(n,i),u.c){var f,m=h.split("."),c=+o.groupSize,l=+o.secondaryGroupSize,g=o.groupSeparator||"",p=m[0],y=m[1],b=u.s<0,P=b?p.slice(1):p,M=P.length;if(l&&(f=c,c=l,l=f,M-=f),c>0&&M>0){for(f=M%c||c,p=P.substr(0,f);f<M;f+=c)p+=g+P.substr(f,c);l>0&&(p+=g+P.slice(f)),b&&(p="-"+p)}h=y?p+(o.decimalSeparator||"")+((l=+o.fractionGroupSize)?y.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(o.fractionGroupSeparator||"")):y):p}return(o.prefix||"")+h+(o.suffix||"")},x.toFraction=function(n){var i,o,h,u,f,m,c,l,g,p,y,b,P=this,M=P.c;if(n!=null&&(c=new a(n),!c.isInteger()&&(c.c||c.s!==1)||c.lt($)))throw Error(w+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!M)return new a(P);for(i=new a($),g=o=new a($),h=l=new a($),b=L(M),f=i.e=b.length-P.e-1,i.c[0]=G[(m=f%v)<0?v+m:m],n=!n||c.comparedTo(i)>0?f>0?i:g:c,m=oe,oe=1/0,c=new a(b),l.c[0]=0;p=N(c,i,0,1),u=o.plus(p.times(h)),u.comparedTo(n)!=1;)o=h,h=u,g=l.plus(p.times(u=g)),l=u,i=c.minus(p.times(u=i)),c=u;return u=N(n.minus(o),h,0,1),l=l.plus(u.times(g)),o=o.plus(u.times(h)),l.s=g.s=P.s,f=f*2,y=N(g,h,f,F).minus(P).abs().comparedTo(N(l,o,f,F).minus(P).abs())<1?[g,h]:[l,o],oe=m,y},x.toNumber=function(){return+Z(this)},x.toPrecision=function(n,i){return n!=null&&D(n,1,B),E(this,n,i,2)},x.toString=function(n){var i,o=this,h=o.s,u=o.e;return u===null?h?(i="Infinity",h<0&&(i="-"+i)):i="NaN":(n==null?i=u<=ee||u>=se?Re(L(o.c),u):le(L(o.c),u,"0"):n===10&&xe?(o=X(new a(o),T+u+1,F),i=le(L(o.c),o.e,"0")):(D(n,2,_e.length,"Base"),i=U(le(L(o.c),u,"0"),10,n,h,!0)),h<0&&o.c[0]&&(i="-"+i)),i},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,O!=null&&a.set(O),a}function K(O){var N=O|0;return O>0||O===N?N:N-1}function L(O){for(var N,U,H=1,x=O.length,$=O[0]+"";H<x;){for(N=O[H++]+"",U=v-N.length;U--;N="0"+N);$+=N}for(x=$.length;$.charCodeAt(--x)===48;);return $.slice(0,x+1||1)}function Y(O,N){var U,H,x=O.c,$=N.c,T=O.s,F=N.s,ee=O.e,se=N.e;if(!T||!F)return null;if(U=x&&!x[0],H=$&&!$[0],U||H)return U?H?0:-F:T;if(T!=F)return T;if(U=T<0,H=ee==se,!x||!$)return H?0:!x^U?1:-1;if(!H)return ee>se^U?1:-1;for(F=(ee=x.length)<(se=$.length)?ee:se,T=0;T<F;T++)if(x[T]!=$[T])return x[T]>$[T]^U?1:-1;return ee==se?0:ee>se^U?1:-1}function D(O,N,U,H){if(O<N||O>U||O!==d(O))throw Error(w+(H||"Argument")+(typeof O=="number"?O<N||O>U?" out of range: ":" not an integer: ":" not a primitive number: ")+String(O))}function Me(O){var N=O.c.length-1;return K(O.e/v)==N&&O.c[N]%2!=0}function Re(O,N){return(O.length>1?O.charAt(0)+"."+O.slice(1):O)+(N<0?"e":"e+")+N}function le(O,N,U){var H,x;if(N<0){for(x=U+".";++N;x+=U);O=x+O}else if(H=O.length,++N>H){for(x=U,N-=H;--N;x+=U);O+=x}else N<H&&(O=O.slice(0,N)+"."+O.slice(N));return O}e=ge(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Ze<"u"&&Ze.exports?Ze.exports=e:(t||(t=typeof self<"u"&&self?self:window),t.BigNumber=e)})(Er)});var Ht=A(Ee=>{"use strict";var In=Ee&&Ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.ChainValue=Ee.ChainValueFormats=void 0;var He=In(Be());He.default.config({EXPONENTIAL_AT:[-9,20],DECIMAL_PLACES:8});var qn={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0,suffix:""},Un={decimalSeparator:",",groupSeparator:".",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0,suffix:""};Ee.ChainValueFormats={DotDecimal:qn,CommaDecimal:Un};function Qe(t){if(!(t&&/^-?\d*(\.\d+)?$/.test(t)))throw new Error(`Invalid value: ${t}`)}var Lt=class t{_big;_decimals;constructor(e){if(e<0||e>8)throw new Error("Decimals must be between 0 and 8");this._big=new He.default(0),this._decimals=e}static create(e){return new t(e)}getDecimals(){return this._decimals}getRaw(){return this._big}getAtomic(){return this._big.dp(0).toString()}setAtomic(e){return typeof e=="number"?this._big=new He.default(Math.floor(e)):(Qe(e),this._big=new He.default(e)),this}getCompound(){return this._big.dividedBy(10**this._decimals).dp(this._decimals).toString()}setCompound(e){return typeof e=="string"&&Qe(e),this._big=new He.default(e||0).multipliedBy(10**this._decimals),this}equals(e){return this._big.eq(e._big)}lessOrEqual(e){return this._big.lte(e._big)}less(e){return this._big.lt(e._big)}greaterOrEqual(e){return this._big.gte(e._big)}greater(e){return this._big.gt(e._big)}add(e){return this._big=this._big.plus(e._big),this}subtract(e){return this._big=this._big.minus(e._big),this}multiply(e){let r=e;return typeof e=="string"&&(Qe(e),r=parseFloat(e)),this._big=this._big.multipliedBy(r),this}divide(e){let r=e;if(typeof e=="string"&&(Qe(e),r=parseFloat(e)),r===0)throw new Error("Division by zero");return this._big=this._big.div(r),this}toFormat(e,r=Ee.ChainValueFormats.DotDecimal){return this._big.dividedBy(10**this._decimals).toFormat({...r,prefix:e})}clone(){let e=new t(this._decimals);return e._big=this._big,e}};Ee.ChainValue=Lt});var Gt=A(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.OneSignaPlanck=be.FeeQuantPlanck=be.CurrencySymbol=void 0;be.CurrencySymbol="\uA7A8";be.FeeQuantPlanck=1e6;be.OneSignaPlanck=1e8});var Je=A(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.Amount=ue.AmountFormats=ue.FormatCommaDecimal=ue.FormatDotDecimal=void 0;var $t=Gt(),Fn=Ht();ue.FormatDotDecimal={prefix:$t.CurrencySymbol+" ",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0,suffix:""};ue.FormatCommaDecimal={prefix:$t.CurrencySymbol+" ",decimalSeparator:",",groupSeparator:".",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0,suffix:""};ue.AmountFormats={DotDecimal:ue.FormatDotDecimal,CommaDecimal:ue.FormatCommaDecimal};var jt=class t{_value;constructor(e){this._value=new Fn.ChainValue(8).setAtomic(e)}static CurrencySymbol(){return $t.CurrencySymbol}static Zero(){return new t(0)}static fromPlanck(e){return new t(e)}static fromSigna(e){let r=new t("0");return r.setSigna(typeof e=="number"?e.toString(10):e),r}getRaw(){return this._value.getRaw()}getPlanck(){return this._value.getAtomic()}setPlanck(e){return this._value.setAtomic(e),this}getSigna(){return this._value.getCompound()}setSigna(e){return this._value.setCompound(e),this}equals(e){return this._value.equals(e._value)}lessOrEqual(e){return this._value.lessOrEqual(e._value)}less(e){return this._value.less(e._value)}greaterOrEqual(e){return this._value.greaterOrEqual(e._value)}greater(e){return this._value.greater(e._value)}add(e){return this._value.add(e._value),this}subtract(e){return this._value.subtract(e._value),this}multiply(e){return this._value.multiply(e),this}divide(e){return this._value.divide(e),this}toString(e=ue.AmountFormats.DotDecimal){return this._value.toFormat(e.prefix,e)}clone(){return t.fromPlanck(this.getPlanck())}};ue.Amount=jt});var Sr=A(Te=>{"use strict";var Ln=Te&&Te.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Te,"__esModule",{value:!0});Te.convertBase36StringToHexString=void 0;var Hn=Ln(Be()),Gn=t=>new Hn.default(t,36).toString(16);Te.convertBase36StringToHexString=Gn});var Kt=A((kt,zt)=>{(function(t,e){typeof kt=="object"&&typeof zt<"u"?zt.exports=e():typeof define=="function"&&define.amd?define(e):function(){var r=t.Base64,s=e();s.noConflict=function(){return t.Base64=r,s},t.Meteor&&(Base64=s),t.Base64=s}()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:kt,function(){"use strict";var t="3.7.7",e=t,r=typeof Buffer=="function",s=typeof TextDecoder=="function"?new TextDecoder:void 0,d=typeof TextEncoder=="function"?new TextEncoder:void 0,w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",S=Array.prototype.slice.call(w),_=function(a){var E={};return a.forEach(function(W,re){return E[W]=re}),E}(S),v=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,R=String.fromCharCode.bind(String),G=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(a){return new Uint8Array(Array.prototype.slice.call(a,0))},j=function(a){return a.replace(/=/g,"").replace(/[+\/]/g,function(E){return E=="+"?"-":"_"})},B=function(a){return a.replace(/[^A-Za-z0-9\+\/]/g,"")},ge=function(a){for(var E,W,re,X,Z="",n=a.length%3,i=0;i<a.length;){if((W=a.charCodeAt(i++))>255||(re=a.charCodeAt(i++))>255||(X=a.charCodeAt(i++))>255)throw new TypeError("invalid character found");E=W<<16|re<<8|X,Z+=S[E>>18&63]+S[E>>12&63]+S[E>>6&63]+S[E&63]}return n?Z.slice(0,n-3)+"===".substring(n):Z},K=typeof btoa=="function"?function(a){return btoa(a)}:r?function(a){return Buffer.from(a,"binary").toString("base64")}:ge,L=r?function(a){return Buffer.from(a).toString("base64")}:function(a){for(var E=4096,W=[],re=0,X=a.length;re<X;re+=E)W.push(R.apply(null,a.subarray(re,re+E)));return K(W.join(""))},Y=function(a,E){return E===void 0&&(E=!1),E?j(L(a)):L(a)},D=function(a){if(a.length<2){var E=a.charCodeAt(0);return E<128?a:E<2048?R(192|E>>>6)+R(128|E&63):R(224|E>>>12&15)+R(128|E>>>6&63)+R(128|E&63)}else{var E=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return R(240|E>>>18&7)+R(128|E>>>12&63)+R(128|E>>>6&63)+R(128|E&63)}},Me=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Re=function(a){return a.replace(Me,D)},le=r?function(a){return Buffer.from(a,"utf8").toString("base64")}:d?function(a){return L(d.encode(a))}:function(a){return K(Re(a))},O=function(a,E){return E===void 0&&(E=!1),E?j(le(a)):le(a)},N=function(a){return O(a,!0)},U=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,H=function(a){switch(a.length){case 4:var E=(7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3),W=E-65536;return R((W>>>10)+55296)+R((W&1023)+56320);case 3:return R((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return R((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},x=function(a){return a.replace(U,H)},$=function(a){if(a=a.replace(/\s+/g,""),!v.test(a))throw new TypeError("malformed base64.");a+="==".slice(2-(a.length&3));for(var E,W="",re,X,Z=0;Z<a.length;)E=_[a.charAt(Z++)]<<18|_[a.charAt(Z++)]<<12|(re=_[a.charAt(Z++)])<<6|(X=_[a.charAt(Z++)]),W+=re===64?R(E>>16&255):X===64?R(E>>16&255,E>>8&255):R(E>>16&255,E>>8&255,E&255);return W},T=typeof atob=="function"?function(a){return atob(B(a))}:r?function(a){return Buffer.from(a,"base64").toString("binary")}:$,F=r?function(a){return G(Buffer.from(a,"base64"))}:function(a){return G(T(a).split("").map(function(E){return E.charCodeAt(0)}))},ee=function(a){return F(me(a))},se=r?function(a){return Buffer.from(a,"base64").toString("utf8")}:s?function(a){return s.decode(F(a))}:function(a){return x(T(a))},me=function(a){return B(a.replace(/[-_]/g,function(E){return E=="-"?"+":"/"}))},oe=function(a){return se(me(a))},we=function(a){if(typeof a!="string")return!1;var E=a.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(E)||!/[^\s0-9a-zA-Z\-_]/.test(E)},Se=function(a){return{value:a,enumerable:!1,writable:!0,configurable:!0}},de=function(){var a=function(E,W){return Object.defineProperty(String.prototype,E,Se(W))};a("fromBase64",function(){return oe(this)}),a("toBase64",function(E){return O(this,E)}),a("toBase64URI",function(){return O(this,!0)}),a("toBase64URL",function(){return O(this,!0)}),a("toUint8Array",function(){return ee(this)})},De=function(){var a=function(E,W){return Object.defineProperty(Uint8Array.prototype,E,Se(W))};a("toBase64",function(E){return Y(this,E)}),a("toBase64URI",function(){return Y(this,!0)}),a("toBase64URL",function(){return Y(this,!0)})},_e=function(){de(),De()},xe={version:t,VERSION:e,atob:T,atobPolyfill:$,btoa:K,btoaPolyfill:ge,fromBase64:oe,toBase64:O,encode:O,encodeURI:N,encodeURL:N,utob:Re,btou:x,decode:oe,isValid:we,fromUint8Array:Y,toUint8Array:ee,extendString:de,extendUint8Array:De,extendBuiltins:_e};return xe.Base64={},Object.keys(xe).forEach(function(a){return xe.Base64[a]=xe[a]}),xe})});var br=A(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.convertBase64StringToString=void 0;var jn=Kt(),$n=t=>jn.Base64.decode(t);Ye.convertBase64StringToString=$n});var Vt=A(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.convertByteArrayToHexString=void 0;var kn=(t,e=!1)=>{let r=[];for(let s of t)r.push((s>>>4).toString(16)),r.push((s&15).toString(16));return e?r.join("").toUpperCase():r.join("")};et.convertByteArrayToHexString=kn});var Wt=A(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.convertByteArrayToString=void 0;var zn=(t,e=0,r=null)=>{if(r===0)return"";let s=t;if(e!==0){let w=r===null?t.length-e:r;Kn(s,w,e),s=t.slice(e,e+w)}let d=escape(String.fromCharCode.apply(null,Array.from(s)));try{return decodeURIComponent(d)}catch{throw new Error("Error decoding utf-8 data")}};tt.convertByteArrayToString=zn;function Kn(t,e,r=0){if(r<0)throw new Error("Start index should not be negative");if(t.length<r+e)throw new Error("Need at least "+e+" bytes to convert to an integer");return r}});var Ar=A(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});String.prototype.padStart||(String.prototype.padStart=function(e,r){return e=e>>0,r=String(r!==void 0?r:" "),this.length>=e?String(this):(e=e-this.length,e>r.length&&(r+=r.repeat(e/r.length)),r.slice(0,e)+String(this))})});var Rr=A(Ie=>{"use strict";var Vn=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.twosComplementBinary=void 0;var Wn=Vn(Be()),Xn=t=>{let e=t.multipliedBy(-1).toString(2);for(;e.length%8;)e="0"+e;let r=e[0]==="1"&&e.slice(1).indexOf("1")!==-1?"11111111":"";return e=e.split("").map(s=>s==="0"?"1":"0").join(""),new Wn.default(r+e,2).plus(1)};Ie.twosComplementBinary=Xn});var Or=A(qe=>{"use strict";var Zn=qe&&qe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qe,"__esModule",{value:!0});qe.convertDecStringToHexString=void 0;Ar();var Qn=Zn(Be()),Jn=Rr(),Yn=(t,e=2)=>{let r=typeof t=="string"?new Qn.default(t):t;if(r.isNaN())throw new Error(`Invalid decimal argument: [${t}] - Expected a valid decimal value`);if(e<0)throw new Error(`Invalid padding argument: [${e}] - Expected a positive value`);let s=r.lt(0);s&&(r=(0,Jn.twosComplementBinary)(r));let d=r.toString(16),w=Math.ceil(d.length/e);return d.padStart(w*e,s?"f":"0")};qe.convertDecStringToHexString=Yn});var Nr=A(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.convertHexEndianess=void 0;var ei=t=>{let e="",r=t;for(let s=r.length-1;s>=0;s-=2)e+=r[s-1]+r[s];return e};rt.convertHexEndianess=ei});var Cr=A(Ue=>{"use strict";var ti=Ue&&Ue.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.convertHexStringToBase36String=void 0;var ri=ti(Be()),ni=t=>new ri.default(t,16).toString(36);Ue.convertHexStringToBase36String=ni});var Xt=A(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.convertHexStringToByteArray=void 0;var ii=t=>{if(t.length%2)throw new Error(`Invalid Hex String: ${t}`);let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let s=parseInt(t.substr(r,2),16);if(Number.isNaN(s))throw new Error(`Invalid Hex String: ${t}`);e[r/2]=s}return e};nt.convertHexStringToByteArray=ii});var Mr=A(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.convertHexStringToDecString=void 0;var si=t=>{let e=[0],r,s,d;for(r=0;r<t.length;r+=1){for(d=parseInt(t.charAt(r),16),s=0;s<e.length;s+=1)e[s]=e[s]*16+d,d=e[s]/10|0,e[s]%=10;for(;d>0;)e.push(d%10),d=d/10|0}return e.reverse().join("")};it.convertHexStringToDecString=si});var Dr=A(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.convertHexStringToString=void 0;var oi=Wt(),ai=Xt(),ci=t=>(0,oi.convertByteArrayToString)((0,ai.convertHexStringToByteArray)(t));st.convertHexStringToString=ci});var Tr=A(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.convertStringToBase64String=void 0;var Br=Kt(),ui=(t,e=!0)=>e?Br.Base64.encodeURI(t):Br.Base64.encode(t);ot.convertStringToBase64String=ui});var Zt=A(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.convertStringToByteArray=void 0;var li=t=>{let e=unescape(encodeURIComponent(t)),r=new Uint8Array(e.length);for(let s=0;s<e.length;++s)r[s]=e.charCodeAt(s);return r};at.convertStringToByteArray=li});var Ir=A(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.convertStringToHexString=void 0;var fi=Zt(),di=Vt(),pi=t=>(0,di.convertByteArrayToHexString)((0,fi.convertStringToByteArray)(t));ct.convertStringToHexString=pi});var qr=A(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.convertAssetPriceToPlanck=gi;var hi=Je();function gi(t,e){return hi.Amount.fromSigna(t).multiply(10**(e-8)).getPlanck()}});var Ur=A(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.convertPlanckToAssetPrice=yi;var mi=Je();function yi(t,e){return mi.Amount.fromSigna(t).divide(10**e).getSigna()}});var Lr=A(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0})});var Hr=A(Oe=>{"use strict";var vi=Oe&&Oe.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var d=Object.getOwnPropertyDescriptor(e,r);(!d||("get"in d?!e.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,d)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),wi=Oe&&Oe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vi(e,t,r)};Object.defineProperty(Oe,"__esModule",{value:!0});wi(Lr(),Oe)});var ut=A(q=>{"use strict";var _i=q&&q.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var d=Object.getOwnPropertyDescriptor(e,r);(!d||("get"in d?!e.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,d)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),V=q&&q.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_i(e,t,r)};Object.defineProperty(q,"__esModule",{value:!0});V(wr(),q);V(xr(),q);V(Ht(),q);V(Je(),q);V(Gt(),q);V(Sr(),q);V(br(),q);V(Vt(),q);V(Wt(),q);V(Or(),q);V(Nr(),q);V(Cr(),q);V(Xt(),q);V(Mr(),q);V(Dr(),q);V(Tr(),q);V(Zt(),q);V(Ir(),q);V(qr(),q);V(Ur(),q);V(Hr(),q)});var ft=A(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.EncoderFormat=void 0;var Gr;(function(t){t[t.Text=0]="Text",t[t.Hexadecimal=1]="Hexadecimal",t[t.Base64=2]="Base64"})(Gr||(lt.EncoderFormat=Gr={}))});var $r=A(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.createDeeplink=void 0;var jr=ut(),dt=ft();function xi(t,e){let r=t;switch(typeof t!="string"&&(r=JSON.stringify(t)),e){case dt.EncoderFormat.Hexadecimal:return(0,jr.convertStringToHexString)(r);case dt.EncoderFormat.Base64:return(0,jr.convertStringToBase64String)(r);case dt.EncoderFormat.Text:default:return r}}var Ei=t=>{let{encoderFormat:e=dt.EncoderFormat.Base64,domain:r,action:s,payload:d}=t,w=r?`signum.${r}://v1`:"signum://v1";return s&&(w+=`?action=${s}`),d&&(w+=`&payload=${xi(d,e)}`),w};pt.createDeeplink=Ei});var zr=A(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.parseDeeplink=void 0;var kr=ut(),ht=ft(),Si=/^signum.?(.+)?:\/\/(v.+?)\??/i,bi=(t,e=ht.EncoderFormat.Base64)=>{let r=()=>{throw new Error("Invalid deeplink: "+t)},s=(_,v)=>{let R=_;switch(v){case ht.EncoderFormat.Hexadecimal:R=(0,kr.convertHexStringToString)(_);break;case ht.EncoderFormat.Base64:R=(0,kr.convertBase64StringToString)(_);break;case ht.EncoderFormat.Text:default:}try{return JSON.parse(R)}catch{return R}},d=(_,v)=>(_.startsWith(v+"=")||r(),_.split("=")[1]),w=t.match(Si);(!w||w.length!==3)&&r();let S={domain:w[1],version:w[2],action:void 0,payload:void 0,decodedPayload:void 0};try{let _=t.indexOf("?");if(_!==-1){let v=t.substring(_+1).split("&");v.length>=1&&(v.length>2&&r(),S.action=d(v[0],"action"),v.length===2&&(S.payload=d(v[1],"payload"),S.decodedPayload=s(S.payload,e)))}}catch{r()}return S};gt.parseDeeplink=bi});var Vr=A(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0})});var Xr=A(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0})});var Zr=A(pe=>{"use strict";var Pi=pe&&pe.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var d=Object.getOwnPropertyDescriptor(e,r);(!d||("get"in d?!e.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,d)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Ge=pe&&pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pi(e,t,r)};Object.defineProperty(pe,"__esModule",{value:!0});Ge($r(),pe);Ge(zr(),pe);Ge(Vr(),pe);Ge(Xr(),pe);Ge(ft(),pe)});var Jr=A(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0})});var en=A(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0})});var rn=A(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0})});var sn=A(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0})});var on=A(ve=>{"use strict";var Ai=ve&&ve.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var d=Object.getOwnPropertyDescriptor(e,r);(!d||("get"in d?!e.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,d)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),mt=ve&&ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ai(e,t,r)};Object.defineProperty(ve,"__esModule",{value:!0});mt(Jr(),ve);mt(en(),ve);mt(rn(),ve);mt(sn(),ve)});var an=A(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.SRC44ParseException=void 0;var Yt=class extends Error{};yt.SRC44ParseException=Yt});var cn=A(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.SRC44ValidationException=void 0;var er=class extends Error{constructor(e){super(`[SRC44 Validation Error]: ${e}`)}};vt.SRC44ValidationException=er});var je=A(Pe=>{"use strict";var Ri=Pe&&Pe.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var d=Object.getOwnPropertyDescriptor(e,r);(!d||("get"in d?!e.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,d)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),un=Pe&&Pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ri(e,t,r)};Object.defineProperty(Pe,"__esModule",{value:!0});un(an(),Pe);un(cn(),Pe)});var ln=A(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.BLANK_URL=J.relativeFirstCharacters=J.whitespaceEscapeCharsRegex=J.urlSchemeRegex=J.ctrlCharactersRegex=J.htmlCtrlEntityRegex=J.htmlEntitiesRegex=J.invalidProtocolRegex=void 0;J.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im;J.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g;J.htmlCtrlEntityRegex=/&(newline|tab);/gi;J.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;J.urlSchemeRegex=/^.+(:|&colon;)/gim;J.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;J.relativeFirstCharacters=[".","/"];J.BLANK_URL="about:blank"});var tr=A(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.sanitizeUrl=void 0;var ie=ln();function Oi(t){return ie.relativeFirstCharacters.indexOf(t[0])>-1}function Ni(t){var e=t.replace(ie.ctrlCharactersRegex,"");return e.replace(ie.htmlEntitiesRegex,function(r,s){return String.fromCharCode(s)})}function Ci(t){return URL.canParse(t)}function fn(t){try{return decodeURIComponent(t)}catch{return t}}function Mi(t){if(!t)return ie.BLANK_URL;var e,r=fn(t.trim());do r=Ni(r).replace(ie.htmlCtrlEntityRegex,"").replace(ie.ctrlCharactersRegex,"").replace(ie.whitespaceEscapeCharsRegex,"").trim(),r=fn(r),e=r.match(ie.ctrlCharactersRegex)||r.match(ie.htmlEntitiesRegex)||r.match(ie.htmlCtrlEntityRegex)||r.match(ie.whitespaceEscapeCharsRegex);while(e&&e.length>0);var s=r;if(!s)return ie.BLANK_URL;if(Oi(s))return s;var d=s.trimStart(),w=d.match(ie.urlSchemeRegex);if(!w)return s;var S=w[0].toLowerCase().trim();if(ie.invalidProtocolRegex.test(S))return ie.BLANK_URL;var _=d.replace(/\\/g,"/");if(S==="mailto:"||S.includes("://"))return _;if(S==="http:"||S==="https:"){if(!Ci(_))return ie.BLANK_URL;var v=new URL(_);return v.protocol=v.protocol.toLowerCase(),v.hostname=v.hostname.toLowerCase(),v.toString()}return _}wt.sanitizeUrl=Mi});var nr=A(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.parseIpfsMedia=Di;var dn=je();function Di(t){if(!t)return;let e=Object.keys(t);if(e.length===1){let r=e[0],s=t[r];if(!s.startsWith("image"))throw new dn.SRC44ParseException(`Only image Mime Types allowed. Got [${s}]`);return{ipfsCid:r,mimeType:s}}throw new dn.SRC44ParseException("Could not parse IPFS Media data")}});var hn=A(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.validateSRC44=Ti;var Bi=je(),pn=nr();function Ti(t,e=!0){let R=["hum","smc","biz","cex","dex","oth","tok","bot"];try{if(e&&t.vs!==1)throw new Error(`vs is required and must be 1 - Got ${t.vs}`);if(t.nm&&t.nm.length>24)throw new Error(`nm must be at maximum 24 bytes - Got ${t.nm}`);if(t.ds&&t.ds.length>384)throw new Error(`ds must be at maximum 384 bytes - Got ${t.ds.length}`);if(t.hp&&t.hp.length>128)throw new Error(`hp must be at maximum 128 bytes - Got ${t.hp.length}`);if(t.id&&t.id.length>48)throw new Error(`id must be at maximum 48 bytes - Got ${t.id.length}`);if(t.al&&!/^\w{1,100}(@[a-zA-Z0-9]{1,40})?$/.test(t.al))throw new Error(`al must match /^\\w{1,100}(@[a-zA-Z0-9]{1,40})?$/ - Got ${t.al}`);if(t.ac&&!/^\d{10,22}$/.test(t.ac))throw new Error(`ac must match /^\\d{10,22}$/ - Got ${t.ac}`);if(e&&t.tp&&R.indexOf(t.tp)<0)throw new Error(`tp must be one of [${R.join(",")}] - Got ${t.tp}`);if(t.av&&(0,pn.parseIpfsMedia)(t.av),t.bg&&(0,pn.parseIpfsMedia)(t.bg),t.sc){if(t.sc.length>3)throw new Error(`sc must be at maximum 3 items - Got ${t.sc.length}`);t.sc.forEach(j=>{if(j.length>92)throw new Error(`sc URL must be at maximum 92 characters - Got ${j.length} for [${j}]`)})}let G=JSON.stringify(t).length;if(G>1e3)throw new Error(`Maximum length of 1000 bytes allowed - Got ${G}`)}catch(G){throw new Bi.SRC44ValidationException(G.message)}}});var xt=A(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.DescriptorData=void 0;var gn=je(),mn=tr(),Ii=hn(),yn=nr(),sr=class t{data;strict;constructor(e,r){this.data=e,this.strict=r,this.validate()}get raw(){return this.data}get version(){return this.data.vs}get name(){return this.data.nm}get alias(){return this.data.al}get id(){return this.data.id}get account(){return this.data.ac}get description(){return this.data.ds}get type(){return this.data.tp}get extension(){return this.data.xt}get avatar(){return(0,yn.parseIpfsMedia)(this.data.av)}get background(){return(0,yn.parseIpfsMedia)(this.data.bg)}get sendRule(){return this.data.sr?new RegExp(this.data.sr):void 0}get homePage(){return this.data.hp?(0,mn.sanitizeUrl)(this.data.hp):void 0}get socialMediaLinks(){return this.data.sc?this.data.sc.map(mn.sanitizeUrl):void 0}static create(e){return new t({vs:1,nm:e},!0)}static parse(e,r=!0){try{let s=JSON.parse(e);return!r&&!s.vs&&(s.vs=1),new t(s,r)}catch(s){throw new gn.SRC44ParseException(s.message)}}clone(){return new t({...this.data},!0)}merge(e){return this.data={...this.data,...e.data},this}getCustomField(e){return this.data[e]}get(){let{vs:e,nm:r,ds:s,tp:d,av:w,bg:S,hp:_,sc:v,sr:R,xt:G,al:j,id:B,ac:ge,...K}=this.data,L={version:this.version,name:this.name,description:this.description,type:this.type,avatar:this.avatar,background:this.background,homePage:this.homePage,socialMediaLinks:this.socialMediaLinks,sendRule:this.sendRule,extension:this.extension,alias:this.alias,account:this.account,id:this.id,...K};return Object.keys(L).reduce((Y,D)=>(L[D]!==void 0&&(Y[D]=L[D]),Y),{version:1})}validate(){(0,Ii.validateSRC44)(this.raw,this.strict)}stringify(){let r=JSON.stringify(this.data);if(r.length>1e3)throw new gn.SRC44ValidationException(`Data exceeds maximum allowed length of 1000 bytes - Got ${r.length}`);return r}estimateFeePlanck(e=2e7){return String(Math.ceil(this.stringify().length/184)*e)}};_t.DescriptorData=sr});var vn=A(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.DescriptorDataClient=void 0;var Fe=xt(),or=class t{ledger;static SmartContractPublicKey="0000000000000000000000000000000000000000000000000000000000000000";constructor(e){this.ledger=e}async getFromContract(e){let r=await this.ledger.contract.getContract(e),s=Fe.DescriptorData.parse(r.description).get();return s.alias&&(s.resolvedAlias=await this.getFromAlias(s.alias)),s}async getFromAsset(e){let r=await this.ledger.asset.getAsset({assetId:e}),s=Fe.DescriptorData.parse(r.description).get();return s.alias&&(s.resolvedAlias=await this.getFromAlias(s.alias)),s}async setAccountDescriptor(e){let{name:r,senderPublicKey:s,senderPrivateKey:d,feePlanck:w,descriptorData:S,deadline:_,referencedTransactionFullHash:v}=e;return this.ledger.account.setAccountInfo({name:r||S.name,description:S.stringify(),feePlanck:w||S.estimateFeePlanck(),senderPublicKey:s,senderPrivateKey:d,deadline:_,referencedTransactionFullHash:v})}async getAccountByAlias(e){try{let r=await this.getFromAlias(e);return r.account?this.ledger.account.getAccount({accountId:r.account,includeCommittedAmount:!0}):null}catch{return null}}async getAssetBranding(e){try{let r="",{account:s,publicKey:d}=await this.ledger.asset.getAsset({assetId:e});if(d===t.SmartContractPublicKey){let{creator:_}=await this.ledger.contract.getContract(s);r=_}else r=s;let w=[],S=await this.ledger.alias.getAliases({accountId:r});for(let _ of S.aliases)try{let v=Fe.DescriptorData.parse(_.aliasURI);v.id===e&&w.push(v.get())}catch{}return w}catch{return[]}}async setAssetBranding(e){let{aliasName:r,assetId:s,senderPublicKey:d,senderPrivateKey:w,feePlanck:S,descriptorData:_,deadline:v,referencedTransactionFullHash:R,tld:G}=e,[j,B]=await Promise.all([this.ledger.asset.getAsset({assetId:s}),this.ledger.service.query("getAccountId",{publicKey:d})]),{publicKey:ge,account:K}=j,L="";if(ge===t.SmartContractPublicKey){let{creator:Y}=await this.ledger.contract.getContract(K);L=Y}else L=K;if(B.account!==L)throw new Error("Not your asset!");return _.raw.id=s,this.ledger.alias.setAlias({aliasName:r||`asset_brand_${s}`,tld:G,aliasURI:_.stringify(),feePlanck:S||_.estimateFeePlanck(),senderPublicKey:d,senderPrivateKey:w,deadline:v,referencedTransactionFullHash:R})}async getContractBranding(e){try{let{creator:r}=await this.ledger.contract.getContract(e),s=[],d=await this.ledger.alias.getAliases({accountId:r});for(let w of d.aliases)try{let S=Fe.DescriptorData.parse(w.aliasURI);S.id===e&&s.push(S.get())}catch{}return s}catch{return[]}}async setContractBranding(e){let{aliasName:r,contractId:s,senderPublicKey:d,senderPrivateKey:w,feePlanck:S,descriptorData:_,deadline:v,referencedTransactionFullHash:R,tld:G}=e,[j,B]=await Promise.all([this.ledger.contract.getContract(s),this.ledger.service.query("getAccountId",{publicKey:d})]);if(B.account!==j.creator)throw new Error("Not your contract!");return _.raw.id=s,this.ledger.alias.setAlias({aliasName:r||`contract_brand_${s}`,tld:G,aliasURI:_.stringify(),feePlanck:S||_.estimateFeePlanck(),senderPublicKey:d,senderPrivateKey:w,deadline:v,referencedTransactionFullHash:R})}async getFromAccount(e){let r=await this.ledger.account.getAccount({accountId:e,includeCommittedAmount:!1,includeEstimatedCommitment:!1}),s=Fe.DescriptorData.parse(r.description).get();return s.alias&&(s.resolvedAlias=await this.getFromAlias(s.alias)),s}async setAliasDescriptor(e){let{tld:r,aliasName:s,senderPublicKey:d,senderPrivateKey:w,feePlanck:S,descriptorData:_,deadline:v,referencedTransactionFullHash:R}=e;return this.ledger.alias.setAlias({aliasName:s,tld:r,aliasURI:_.stringify(),feePlanck:S||_.estimateFeePlanck(),senderPublicKey:d,senderPrivateKey:w,deadline:v,referencedTransactionFullHash:R})}async getFromAlias(e){let[r,s]=e.split(":"),{aliasURI:d}=await this.ledger.alias.getAliasByName(r,s);return F