!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).nonRepudiationLibrary={})}(this,(function(e){"use strict";const t=e=>{const t=[];for(let r=0;rnew Uint8Array(atob(e).split("").map((e=>e.charCodeAt(0))));function n(e,r=!1,n=!0){let i="";{const r="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e);i=t(r)}return r&&(i=function(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}(i)),n||(i=i.replace(/=/g,"")),i}function i(e,t=!1){{let n=!1;if(/^[0-9a-zA-Z_-]+={0,2}$/.test(e))n=!0;else if(!/^[0-9a-zA-Z+/]*={0,2}$/.test(e))throw new Error("Not a valid base64 input");n&&(e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/=/g,""));const i=r(e);return t?(new TextDecoder).decode(i):i}}function o(e,t=!1,r){const n=e.match(/^(0x)?([\da-fA-F]+)$/);if(null==n)throw new RangeError("input must be a hexadecimal string, e.g. '0x124fe3a' or '0214f1b2'");let i=n[2];if(void 0!==r){if(r{n+=i[e>>4]+i[15&e]})),o(n,t,r)}}function s(e,t=!1){let r=o(e);return r=o(e,!1,Math.ceil(r.length/2)),Uint8Array.from(r.match(/[\da-fA-F]{2}/g).map((e=>parseInt(e,16)))).buffer}function c(e,t=!1){if(e<1)throw new RangeError("byteLength MUST be > 0");return new Promise((function(r,n){{const n=new Uint8Array(e);if(e<=65536)self.crypto.getRandomValues(n);else for(let t=0;t=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,d=67108863&c,l=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=l;h++){var p=u-h|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?m+n:u[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return r(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(o),f=this.clone();if(c){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[s]=a;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,A=v>>>13,_=0|a[4],E=8191&_,S=_>>>13,P=0|a[5],x=8191&P,k=P>>>13,M=0|a[6],C=8191&M,I=M>>>13,R=0|a[7],N=8191&R,O=R>>>13,T=0|a[8],j=8191&T,D=T>>>13,$=0|a[9],B=8191&$,F=$>>>13,z=0|s[0],U=8191&z,L=z>>>13,q=0|s[1],H=8191&q,K=q>>>13,J=0|s[2],W=8191&J,G=J>>>13,V=0|s[3],Z=8191&V,X=V>>>13,Q=0|s[4],Y=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,fe=0|s[8],de=8191&fe,le=fe>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(u+(n=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,L))+Math.imul(l,U)|0))<<13)|0;u=((o=Math.imul(l,L))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,L))+Math.imul(m,U)|0,o=Math.imul(m,L);var ye=(u+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(l,H)|0))<<13)|0;u=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,U),i=(i=Math.imul(y,L))+Math.imul(b,U)|0,o=Math.imul(b,L),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,K)|0;var be=(u+(n=n+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(l,W)|0))<<13)|0;u=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,L))+Math.imul(A,U)|0,o=Math.imul(A,L),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,G)|0;var ve=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,Z)|0))<<13)|0;u=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,L))+Math.imul(S,U)|0,o=Math.imul(S,L),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var we=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Y)|0))<<13)|0;u=((o=o+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,L))+Math.imul(k,U)|0,o=Math.imul(k,L),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((o=o+Math.imul(l,ne)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,L))+Math.imul(I,U)|0,o=Math.imul(I,L),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,K)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var _e=(u+(n=n+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(l,oe)|0))<<13)|0;u=((o=o+Math.imul(l,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,L))+Math.imul(O,U)|0,o=Math.imul(O,L),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,ce)|0))<<13)|0;u=((o=o+Math.imul(l,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,L))+Math.imul(D,U)|0,o=Math.imul(D,L),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(O,H)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,X)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var Se=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((o=o+Math.imul(l,le)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(B,U),i=(i=Math.imul(B,L))+Math.imul(F,U)|0,o=Math.imul(F,L),n=n+Math.imul(j,H)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,K)|0,n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,le)|0;var Pe=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,pe)|0))<<13)|0;u=((o=o+Math.imul(l,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(B,H),i=(i=Math.imul(B,K))+Math.imul(F,H)|0,o=Math.imul(F,K),n=n+Math.imul(j,W)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(N,Z)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(b,de)|0,o=o+Math.imul(b,le)|0;var xe=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,G))+Math.imul(F,W)|0,o=Math.imul(F,G),n=n+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,n=n+Math.imul(E,ce)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(S,ce)|0,o=o+Math.imul(S,ue)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,le)|0;var ke=(u+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(B,Z),i=(i=Math.imul(B,X))+Math.imul(F,Z)|0,o=Math.imul(F,X),n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(k,ce)|0,o=o+Math.imul(k,ue)|0,n=n+Math.imul(E,de)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,le)|0;var Me=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(B,Y),i=(i=Math.imul(B,ee))+Math.imul(F,Y)|0,o=Math.imul(F,ee),n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ne)|0,n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,n=n+Math.imul(x,de)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,le)|0;var Ce=(u+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;u=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(B,re),i=(i=Math.imul(B,ne))+Math.imul(F,re)|0,o=Math.imul(F,ne),n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,n=n+Math.imul(N,ce)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(C,de)|0,i=(i=i+Math.imul(C,le)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,le)|0;var Ie=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(k,pe)|0))<<13)|0;u=((o=o+Math.imul(k,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),n=n+Math.imul(j,ce)|0,i=(i=i+Math.imul(j,ue)|0)+Math.imul(D,ce)|0,o=o+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,le)|0;var Re=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(B,ce),i=(i=Math.imul(B,ue))+Math.imul(F,ce)|0,o=Math.imul(F,ue),n=n+Math.imul(j,de)|0,i=(i=i+Math.imul(j,le)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,le)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(B,de),i=(i=Math.imul(B,le))+Math.imul(F,de)|0,o=Math.imul(F,le);var Oe=(u+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,me)|0)+Math.imul(D,pe)|0))<<13)|0;u=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Te=(u+(n=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,c[0]=ge,c[1]=ye,c[2]=be,c[3]=ve,c[4]=we,c[5]=Ae,c[6]=_e,c[7]=Ee,c[8]=Se,c[9]=Pe,c[10]=xe,c[11]=ke,c[12]=Me,c[13]=Ce,c[14]=Ie,c[15]=Re,c[16]=Ne,c[17]=Oe,c[18]=Te,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=l),i.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?l(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==f||u>=i);u--){var d=0|this.words[u];this.words[u]=f<<26-o|d>>>o,f=d&s}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;d--){var l=67108864*(0|n.words[o.length+d])+(0|n.words[o.length+d-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},i.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var l=0,h=1;0==(t.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(f),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(f),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,l=1;0==(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new E(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},n(v,b),v.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return y[e]=t,t},E.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var d=this.pow(f,o),l=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var d=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,E),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,u)}(m);var y=m.exports,b=v;function v(e,t){if(!e)throw new Error(t||"Assertion failed")}v.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var w={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r},t.zero2=r,t.toHex=n,t.encode=function(e,t){return"hex"===t?n(e):e}}(w),function(e){var t=e,r=y,n=b,i=w;t.assert=n,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=0==(1&c)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(a),s=0==(1&u)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(p);var A,_={exports:{}};function E(e){this.rand=e}if(_.exports=function(e){return A||(A=new E(null)),A.generate(e)},_.exports.Rand=E,E.prototype.generate=function(e){return this._rand(e)},E.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var O=N;function T(e,t){this.curve=e,this.type=t,this.precomputed=null}N.prototype.point=function(){throw new Error("Not implemented")},N.prototype.validate=function(){throw new Error("Not implemented")},N.prototype._fixedNafMul=function(e,t){R(e.precomputed);var r=e._getDoubles(),n=C(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];R(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},N.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,f=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=I(r[h],r[p]);for(d=Math.max(y[0].length,d),f[h]=new Array(d),f[p]=new Array(d),a=0;a=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},T.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},U.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},U.prototype.pointFromX=function(e,t){(e=new $(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},U.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},U.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},q.prototype.isInfinity=function(){return this.inf},q.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},q.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},q.prototype.getX=function(){return this.x.fromRed()},q.prototype.getY=function(){return this.y.fromRed()},q.prototype.mul=function(e){return e=new $(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},q.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},q.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},q.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},q.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},q.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},B(H,F.BasePoint),U.prototype.jpoint=function(e,t,r){return new H(this,e,t,r)},H.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},H.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},H.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),d=n.redMul(u),l=c.redSqr().redIAdd(f).redISub(d).redISub(d),h=c.redMul(d.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,h,p)},H.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),f=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(f).redISub(f),l=s.redMul(f.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,l,h)},H.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},H.prototype.inspect=function(){return this.isInfinity()?"":""},H.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var K=y,J=D,W=O,G=p;function V(e){W.call(this,"mont",e),this.a=new K(e.a,16).toRed(this.red),this.b=new K(e.b,16).toRed(this.red),this.i4=new K(4).toRed(this.red).redInvm(),this.two=new K(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}J(V,W);var Z=V;function X(e,t,r){W.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new K(t,16),this.z=new K(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}V.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},J(X,W.BasePoint),V.prototype.decodePoint=function(e,t){return this.point(G.toArray(e,t),1)},V.prototype.point=function(e,t){return new X(this,e,t)},V.prototype.pointFromJSON=function(e){return X.fromJSON(this,e)},X.prototype.precompute=function(){},X.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},X.fromJSON=function(e,t){return new X(e,t[0],t[1]||e.one)},X.prototype.inspect=function(){return this.isInfinity()?"":""},X.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},X.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},X.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},X.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},X.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},X.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},X.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},X.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},X.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},X.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Q=y,Y=D,ee=O,te=p.assert;function re(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,ee.call(this,"edwards",e),this.a=new Q(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Q(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Q(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),te(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}Y(re,ee);var ne=re;function ie(e,t,r,n,i){ee.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Q(t,16),this.y=new Q(r,16),this.z=n?new Q(n,16):this.curve.one,this.t=i&&new Q(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}re.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},re.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},re.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},re.prototype.pointFromX=function(e,t){(e=new Q(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},re.prototype.pointFromY=function(e,t){(e=new Q(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},re.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},Y(ie,ee.BasePoint),re.prototype.pointFromJSON=function(e){return ie.fromJSON(this,e)},re.prototype.point=function(e,t,r,n){return new ie(this,e,t,r,n)},ie.fromJSON=function(e,t){return new ie(e,t[0],t[1],t[2])},ie.prototype.inspect=function(){return this.isInfinity()?"":""},ie.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},ie.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),c=i.redMul(a),u=o.redMul(s),f=i.redMul(s),d=a.redMul(o);return this.curve.point(c,u,d,f)},ie.prototype._projDbl=function(){var e,t,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=s.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},ie.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},ie.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),c=r.redAdd(t),u=o.redMul(a),f=s.redMul(c),d=o.redMul(c),l=a.redMul(s);return this.curve.point(u,f,l,d)},ie.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=n.redMul(c).redMul(f);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},ie.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},ie.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},ie.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},ie.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},ie.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},ie.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},ie.prototype.getX=function(){return this.normalize(),this.x.fromRed()},ie.prototype.getY=function(){return this.normalize(),this.y.fromRed()},ie.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},ie.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},ie.prototype.toP=ie.prototype.normalize,ie.prototype.mixedAdd=ie.prototype.add,function(e){var t=e;t.base=O,t.short=L,t.mont=Z,t.edwards=ne}(x);var oe={},ae={},se={},ce=b,ue=D;function fe(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function de(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function le(e){return 1===e.length?"0"+e:e}function he(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}se.inherits=ue,se.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):fe(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},se.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},se.rotr32=function(e,t){return e>>>t|e<<32-t},se.rotl32=function(e,t){return e<>>32-t},se.sum32=function(e,t){return e+t>>>0},se.sum32_3=function(e,t,r){return e+t+r>>>0},se.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},se.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},se.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},se.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},se.sum64_lo=function(e,t,r,n){return t+n>>>0},se.sum64_4_hi=function(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},se.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},se.sum64_5_hi=function(e,t,r,n,i,o,a,s,c,u){var f=0,d=t;return f+=(d=d+n>>>0)>>0)>>0)>>0)>>0},se.sum64_5_lo=function(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0},se.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},se.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},se.shr64_hi=function(e,t,r){return e>>>r},se.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var pe={},me=se,ge=b;function ye(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}pe.BlockHash=ye,ye.prototype.update=function(e,t){if(e=me.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=me.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3},ve.g1_256=function(e){return we(e,17)^we(e,19)^e>>>10};var Se=se,Pe=pe,xe=ve,ke=Se.rotl32,Me=Se.sum32,Ce=Se.sum32_5,Ie=xe.ft_1,Re=Pe.BlockHash,Ne=[1518500249,1859775393,2400959708,3395469782];function Oe(){if(!(this instanceof Oe))return new Oe;Re.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Se.inherits(Oe,Re);var Te=Oe;Oe.blockSize=512,Oe.outSize=160,Oe.hmacStrength=80,Oe.padLength=64,Oe.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),Yt(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var ur=cr;cr.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},cr.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=ar.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var pr=y,mr=p,gr=mr.assert;function yr(e,t){if(e instanceof yr)return e;this._importDER(e,t)||(gr(e.r&&e.s,"Signature without r or s"),this.r=new pr(e.r,16),this.s=new pr(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var br=yr;function vr(){this.place=0}function wr(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function Ar(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}yr.prototype._importDER=function(e,t){e=mr.toArray(e,t);var r=new vr;if(48!==e[r.place++])return!1;var n=wr(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=wr(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=wr(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new pr(o),this.s=new pr(s),this.recoveryParam=null,!0},yr.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=Ar(t),r=Ar(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];_r(n,t.length),(n=n.concat(t)).push(2),_r(n,r.length);var i=n.concat(r),o=[48];return _r(o,i.length),o=o.concat(i),mr.encode(o,e)};var Er=y,Sr=ur,Pr=oe,xr=P,kr=p.assert,Mr=hr,Cr=br;function Ir(e){if(!(this instanceof Ir))return new Ir(e);"string"==typeof e&&(kr(Object.prototype.hasOwnProperty.call(Pr,e),"Unknown curve "+e),e=Pr[e]),e instanceof Pr.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var Rr=Ir;Ir.prototype.keyPair=function(e){return new Mr(this,e)},Ir.prototype.keyFromPrivate=function(e,t){return Mr.fromPrivate(this,e,t)},Ir.prototype.keyFromPublic=function(e,t){return Mr.fromPublic(this,e,t)},Ir.prototype.genKeyPair=function(e){e||(e={});for(var t=new Sr({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||xr(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Er(2));;){var i=new Er(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Ir.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Ir.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new Er(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new Sr({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new Er(1)),u=0;;u++){var f=n.k?n.k(u):new Er(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var l=d.getX(),h=l.umod(this.n);if(0!==h.cmpn(0)){var p=f.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==l.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new Cr({r:h,s:p,recoveryParam:m})}}}}}},Ir.prototype.verify=function(e,t,r,n){e=this._truncateToN(new Er(e,16)),r=this.keyFromPublic(r,n);var i=(t=new Cr(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},Ir.prototype.recoverPubKey=function(e,t,r,n){kr((3&r)===r,"The recovery param is more than two bits"),t=new Cr(t,n);var i=this.n,o=new Er(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var f=t.r.invm(i),d=i.sub(o).mul(f).umod(i),l=s.mul(f).umod(i);return this.g.mulAdd(d,a,l)},Ir.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Cr(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Nr=p,Or=Nr.assert,Tr=Nr.parseBytes,jr=Nr.cachedProperty;function Dr(e,t){this.eddsa=e,this._secret=Tr(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Tr(t.pub)}Dr.fromPublic=function(e,t){return t instanceof Dr?t:new Dr(e,{pub:t})},Dr.fromSecret=function(e,t){return t instanceof Dr?t:new Dr(e,{secret:t})},Dr.prototype.secret=function(){return this._secret},jr(Dr,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),jr(Dr,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),jr(Dr,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),jr(Dr,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),jr(Dr,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),jr(Dr,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Dr.prototype.sign=function(e){return Or(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Dr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Dr.prototype.getSecret=function(e){return Or(this._secret,"KeyPair is public only"),Nr.encode(this.secret(),e)},Dr.prototype.getPublic=function(e){return Nr.encode(this.pubBytes(),e)};var $r=Dr,Br=y,Fr=p,zr=Fr.assert,Ur=Fr.cachedProperty,Lr=Fr.parseBytes;function qr(e,t){this.eddsa=e,"object"!=typeof t&&(t=Lr(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),zr(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Br&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Ur(qr,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Ur(qr,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Ur(qr,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Ur(qr,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),qr.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},qr.prototype.toHex=function(){return Fr.encode(this.toBytes(),"hex").toUpperCase()};var Hr=qr,Kr=ae,Jr=oe,Wr=p,Gr=Wr.assert,Vr=Wr.parseBytes,Zr=$r,Xr=Hr;function Qr(e){if(Gr("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Qr))return new Qr(e);e=Jr[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Kr.sha512}var Yr=Qr;Qr.prototype.sign=function(e,t){e=Vr(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},Qr.prototype.verify=function(e,t,r){e=Vr(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},Qr.prototype.hashInt=function(){for(var e=this.hash(),t=0;te instanceof CryptoKey,fn=async(e,t)=>{const r=`SHA-${e.slice(-3)}`;return new Uint8Array(await cn.subtle.digest(r,t))},dn=new TextEncoder,ln=new TextDecoder,hn=2**32;function pn(...e){const t=e.reduce(((e,{length:t})=>e+t),0),r=new Uint8Array(t);let n=0;return e.forEach((e=>{r.set(e,n),n+=e.length})),r}function mn(e,t,r){if(t<0||t>=hn)throw new RangeError(`value must be >= 0 and <= ${hn-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function gn(e){const t=Math.floor(e/hn),r=e%hn,n=new Uint8Array(8);return mn(n,t,0),mn(n,r,4),n}function yn(e){const t=new Uint8Array(4);return mn(t,e),t}function bn(e){return pn(yn(e.length),e)}const vn=e=>(e=>{let t=e;"string"==typeof t&&(t=dn.encode(t));const r=[];for(let e=0;e{let t=e;t instanceof Uint8Array&&(t=ln.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return(e=>{const t=atob(e),r=new Uint8Array(t.length);for(let e=0;eRn(new Uint8Array(Nn(e)>>3));const Tn=(e,t)=>{if(t.length<<3!==Nn(e))throw new kn("Invalid Initialization Vector length")},jn=(e,t)=>{const r=e.byteLength<<3;if(r!==t)throw new kn(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)};function Dn(){return"undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime}function $n(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Bn(e,t){return e.name===t}function Fn(e){return parseInt(e.name.slice(4),10)}function zn(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}function Un(e,t,...r){switch(t){case"HS256":case"HS384":case"HS512":{if(!Bn(e.algorithm,"HMAC"))throw $n("HMAC");const r=parseInt(t.slice(2),10);if(Fn(e.algorithm.hash)!==r)throw $n(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Bn(e.algorithm,"RSASSA-PKCS1-v1_5"))throw $n("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(Fn(e.algorithm.hash)!==r)throw $n(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Bn(e.algorithm,"RSA-PSS"))throw $n("RSA-PSS");const r=parseInt(t.slice(2),10);if(Fn(e.algorithm.hash)!==r)throw $n(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name){if(Dn()){if(Bn(e.algorithm,"NODE-ED25519"))break;throw $n("Ed25519, Ed448, or NODE-ED25519")}throw $n("Ed25519 or Ed448")}break;case"ES256":case"ES384":case"ES512":{if(!Bn(e.algorithm,"ECDSA"))throw $n("ECDSA");const r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw $n(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}zn(e,r)}function Ln(e,t,...r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!Bn(e.algorithm,"AES-GCM"))throw $n("AES-GCM");const r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw $n(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!Bn(e.algorithm,"AES-KW"))throw $n("AES-KW");const r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw $n(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw $n("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!Bn(e.algorithm,"PBKDF2"))throw $n("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!Bn(e.algorithm,"RSA-OAEP"))throw $n("RSA-OAEP");const r=parseInt(t.slice(9),10)||1;if(Fn(e.algorithm.hash)!==r)throw $n(`SHA-${r}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}zn(e,r)}function qn(e,t,...r){if(r.length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(e+=` Received an instance of ${t.constructor.name}`),e}var Hn=(e,...t)=>qn("Key must be ",e,...t);function Kn(e,t,...r){return qn(`Key for the ${e} algorithm must be `,t,...r)}var Jn=e=>un(e);const Wn=["CryptoKey"];async function Gn(e,t,r,n,i,o){if(!(t instanceof Uint8Array))throw new TypeError(Hn(t,"Uint8Array"));const a=parseInt(e.slice(1,4),10),s=await cn.subtle.importKey("raw",t.subarray(a>>3),"AES-CBC",!1,["decrypt"]),c=await cn.subtle.importKey("raw",t.subarray(0,a>>3),{hash:"SHA-"+(a<<1),name:"HMAC"},!1,["sign"]),u=pn(o,n,r,gn(o.length<<3)),f=new Uint8Array((await cn.subtle.sign("HMAC",c,u)).slice(0,a>>3));let d,l;try{d=((e,t)=>{if(!(e instanceof Uint8Array))throw new TypeError("First argument must be a buffer");if(!(t instanceof Uint8Array))throw new TypeError("Second argument must be a buffer");if(e.length!==t.length)throw new TypeError("Input buffers must have the same length");const r=e.length;let n=0,i=-1;for(;++i{if(!(un(t)||t instanceof Uint8Array))throw new TypeError(Hn(t,...Wn,"Uint8Array"));switch(Tn(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return t instanceof Uint8Array&&jn(t,parseInt(e.slice(-3),10)),Gn(e,t,r,n,i,o);case"A128GCM":case"A192GCM":case"A256GCM":return t instanceof Uint8Array&&jn(t,parseInt(e.slice(1,4),10)),async function(e,t,r,n,i,o){let a;t instanceof Uint8Array?a=await cn.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(Ln(t,e,"decrypt"),a=t);try{return new Uint8Array(await cn.subtle.decrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},a,pn(r,i)))}catch(e){throw new xn}}(e,t,r,n,i,o);default:throw new Pn("Unsupported JWE Content Encryption Algorithm")}},Zn=async()=>{throw new Pn('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.')},Xn=async()=>{throw new Pn('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.')},Qn=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0};function Yn(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}const ei=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]];function ti(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function ri(e,t,r){if(un(e))return Ln(e,t,r),e;if(e instanceof Uint8Array)return cn.subtle.importKey("raw",e,"AES-KW",!0,[r]);throw new TypeError(Hn(e,...Wn,"Uint8Array"))}const ni=async(e,t,r)=>{const n=await ri(t,e,"wrapKey");ti(n,e);const i=await cn.subtle.importKey("raw",r,...ei);return new Uint8Array(await cn.subtle.wrapKey("raw",i,n,"AES-KW"))},ii=async(e,t,r)=>{const n=await ri(t,e,"unwrapKey");ti(n,e);const i=await cn.subtle.unwrapKey("raw",r,n,"AES-KW",...ei);return new Uint8Array(await cn.subtle.exportKey("raw",i))};async function oi(e,t,r,n,i=new Uint8Array(0),o=new Uint8Array(0)){if(!un(e))throw new TypeError(Hn(e,...Wn));if(Ln(e,"ECDH"),!un(t))throw new TypeError(Hn(t,...Wn));Ln(t,"ECDH","deriveBits");const a=pn(bn(dn.encode(r)),bn(i),bn(o),yn(n));let s;s="X25519"===e.algorithm.name?256:"X448"===e.algorithm.name?448:Math.ceil(parseInt(e.algorithm.namedCurve.substr(-3),10)/8)<<3;return async function(e,t,r){const n=Math.ceil((t>>3)/32),i=new Uint8Array(32*n);for(let t=0;t>3)}(new Uint8Array(await cn.subtle.deriveBits({name:e.algorithm.name,public:e},t,s)),n,a)}function ai(e){if(!un(e))throw new TypeError(Hn(e,...Wn));return["P-256","P-384","P-521"].includes(e.algorithm.namedCurve)||"X25519"===e.algorithm.name||"X448"===e.algorithm.name}async function si(e,t,r,n){!function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new kn("PBES2 Salt Input must be 8 or more octets")}(e);const i=function(e,t){return pn(dn.encode(e),new Uint8Array([0]),t)}(t,e),o=parseInt(t.slice(13,16),10),a={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},s={length:o,name:"AES-KW"},c=await function(e,t){if(e instanceof Uint8Array)return cn.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);if(un(e))return Ln(e,t,"deriveBits","deriveKey"),e;throw new TypeError(Hn(e,...Wn,"Uint8Array"))}(n,t);if(c.usages.includes("deriveBits"))return new Uint8Array(await cn.subtle.deriveBits(a,c,o));if(c.usages.includes("deriveKey"))return cn.subtle.deriveKey(a,c,s,!1,["wrapKey","unwrapKey"]);throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}const ci=async(e,t,r,n,i)=>{const o=await si(i,e,n,t);return ii(e.slice(-6),o,r)};function ui(e){switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new Pn(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}var fi=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}};const di=async(e,t,r)=>{if(!un(t))throw new TypeError(Hn(t,...Wn));if(Ln(t,e,"decrypt","unwrapKey"),fi(e,t),t.usages.includes("decrypt"))return new Uint8Array(await cn.subtle.decrypt(ui(e),t,r));if(t.usages.includes("unwrapKey")){const n=await cn.subtle.unwrapKey("raw",r,t,ui(e),...ei);return new Uint8Array(await cn.subtle.exportKey("raw",n))}throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')};function li(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new Pn(`Unsupported JWE Algorithm: ${e}`)}}var hi=e=>Rn(new Uint8Array(li(e)>>3));var pi=async e=>{var t,r;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:n,keyUsages:i}=function(e){let t,r;switch(e.kty){case"oct":switch(e.alg){case"HS256":case"HS384":case"HS512":t={name:"HMAC",hash:`SHA-${e.alg.slice(-3)}`},r=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":throw new Pn(`${e.alg} keys cannot be imported as CryptoKey instances`);case"A128GCM":case"A192GCM":case"A256GCM":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":t={name:"AES-GCM"},r=["encrypt","decrypt"];break;case"A128KW":case"A192KW":case"A256KW":t={name:"AES-KW"},r=["wrapKey","unwrapKey"];break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":t={name:"PBKDF2"},r=["deriveBits"];break;default:throw new Pn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Pn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new Pn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"EdDSA":t={name:e.crv},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new Pn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new Pn('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),o=[n,null!==(t=e.ext)&&void 0!==t&&t,null!==(r=e.key_ops)&&void 0!==r?r:i];if("PBKDF2"===n.name)return cn.subtle.importKey("raw",wn(e.k),...o);const a={...e};delete a.alg,delete a.use;try{return await cn.subtle.importKey("jwk",a,...o)}catch(e){if("Ed25519"===n.name&&"NotSupportedError"===(null==e?void 0:e.name)&&Dn())return o[0]={name:"NODE-ED25519",namedCurve:"NODE-ED25519"},await cn.subtle.importKey("jwk",a,...o);throw e}};async function mi(e,t,r){var n;if(!Yn(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=r||(r=!0!==e.ext),r?pi({...e,alg:t,ext:null!==(n=e.ext)&&void 0!==n&&n}):wn(e.k);case"RSA":if(void 0!==e.oth)throw new Pn('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return pi({...e,alg:t});default:throw new Pn('Unsupported "kty" (Key Type) Parameter value')}}const gi=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?((e,t)=>{if(!(t instanceof Uint8Array)){if(!Jn(t))throw new TypeError(Kn(e,t,...Wn,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${Wn.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}})(e,t):((e,t,r)=>{if(!Jn(t))throw new TypeError(Kn(e,t,...Wn));if("secret"===t.type)throw new TypeError(`${Wn.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${Wn.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${Wn.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${Wn.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${Wn.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)})(e,t,r)};const yi=async(e,t,r,n,i)=>{if(!(un(r)||r instanceof Uint8Array))throw new TypeError(Hn(r,...Wn,"Uint8Array"));switch(Tn(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&jn(r,parseInt(e.slice(-3),10)),async function(e,t,r,n,i){if(!(r instanceof Uint8Array))throw new TypeError(Hn(r,"Uint8Array"));const o=parseInt(e.slice(1,4),10),a=await cn.subtle.importKey("raw",r.subarray(o>>3),"AES-CBC",!1,["encrypt"]),s=await cn.subtle.importKey("raw",r.subarray(0,o>>3),{hash:"SHA-"+(o<<1),name:"HMAC"},!1,["sign"]),c=new Uint8Array(await cn.subtle.encrypt({iv:n,name:"AES-CBC"},a,t)),u=pn(i,n,c,gn(i.length<<3));return{ciphertext:c,tag:new Uint8Array((await cn.subtle.sign("HMAC",s,u)).slice(0,o>>3))}}(e,t,r,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&jn(r,parseInt(e.slice(1,4),10)),async function(e,t,r,n,i){let o;r instanceof Uint8Array?o=await cn.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(Ln(r,e,"encrypt"),o=r);const a=new Uint8Array(await cn.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},o,t)),s=a.slice(-16);return{ciphertext:a.slice(0,-16),tag:s}}(e,t,r,n,i);default:throw new Pn("Unsupported JWE Content Encryption Algorithm")}};async function bi(e,t,r,n,i){switch(gi(e,t,"decrypt"),e){case"dir":if(void 0!==r)throw new kn("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new kn("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!Yn(n.epk))throw new kn('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!ai(t))throw new Pn("ECDH with the provided key is not allowed or not supported by your javascript runtime");const i=await mi(n.epk,e);let o,a;if(void 0!==n.apu){if("string"!=typeof n.apu)throw new kn('JOSE Header "apu" (Agreement PartyUInfo) invalid');o=wn(n.apu)}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new kn('JOSE Header "apv" (Agreement PartyVInfo) invalid');a=wn(n.apv)}const s=await oi(i,t,"ECDH-ES"===e?n.enc:e,"ECDH-ES"===e?li(n.enc):parseInt(e.slice(-5,-2),10),o,a);if("ECDH-ES"===e)return s;if(void 0===r)throw new kn("JWE Encrypted Key missing");return ii(e.slice(-6),s,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new kn("JWE Encrypted Key missing");return di(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new kn("JWE Encrypted Key missing");if("number"!=typeof n.p2c)throw new kn('JOSE Header "p2c" (PBES2 Count) missing or invalid');const o=(null==i?void 0:i.maxPBES2Count)||1e4;if(n.p2c>o)throw new kn('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new kn('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return ci(e,t,r,n.p2c,wn(n.p2s))}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new kn("JWE Encrypted Key missing");return ii(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(void 0===r)throw new kn("JWE Encrypted Key missing");if("string"!=typeof n.iv)throw new kn('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new kn('JOSE Header "tag" (Authentication Tag) missing or invalid');return async function(e,t,r,n,i){const o=e.slice(0,7);return Vn(o,t,r,n,i,new Uint8Array(0))}(e,t,r,wn(n.iv),wn(n.tag));default:throw new Pn('Invalid or unsupported "alg" (JWE Algorithm) header value')}}function vi(e,t,r,n,i){if(void 0!==i.crit&&void 0===n.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some((e=>"string"!=typeof e||0===e.length)))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;o=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of n.crit){if(!o.has(t))throw new Pn(`Extension Header Parameter "${t}" is not recognized`);if(void 0===i[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(o.get(t)&&void 0===n[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(n.crit)}const wi=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some((e=>"string"!=typeof e))))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};async function Ai(e,t,r){if(e instanceof Uint8Array&&(e=ln.decode(e)),"string"!=typeof e)throw new kn("Compact JWE must be a string or Uint8Array");const{0:n,1:i,2:o,3:a,4:s,length:c}=e.split(".");if(5!==c)throw new kn("Invalid Compact JWE");const u=await async function(e,t,r){var n;if(!Yn(e))throw new kn("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new kn("JOSE Header missing");if("string"!=typeof e.iv)throw new kn("JWE Initialization Vector missing or incorrect type");if("string"!=typeof e.ciphertext)throw new kn("JWE Ciphertext missing or incorrect type");if("string"!=typeof e.tag)throw new kn("JWE Authentication Tag missing or incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new kn("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new kn("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new kn("JWE AAD incorrect type");if(void 0!==e.header&&!Yn(e.header))throw new kn("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!Yn(e.unprotected))throw new kn("JWE Per-Recipient Unprotected Header incorrect type");let i;if(e.protected)try{const t=wn(e.protected);i=JSON.parse(ln.decode(t))}catch(e){throw new kn("JWE Protected Header is invalid")}if(!Qn(i,e.header,e.unprotected))throw new kn("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const o={...i,...e.header,...e.unprotected};if(vi(kn,new Map,null==r?void 0:r.crit,i,o),void 0!==o.zip){if(!i||!i.zip)throw new kn('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==o.zip)throw new Pn('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:a,enc:s}=o;if("string"!=typeof a||!a)throw new kn("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof s||!s)throw new kn("missing JWE Encryption Algorithm (enc) in JWE Header");const c=r&&wi("keyManagementAlgorithms",r.keyManagementAlgorithms),u=r&&wi("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(c&&!c.has(a))throw new Sn('"alg" (Algorithm) Header Parameter not allowed');if(u&&!u.has(s))throw new Sn('"enc" (Encryption Algorithm) Header Parameter not allowed');let f;void 0!==e.encrypted_key&&(f=wn(e.encrypted_key));let d,l=!1;"function"==typeof t&&(t=await t(i,e),l=!0);try{d=await bi(a,t,f,o,r)}catch(e){if(e instanceof TypeError||e instanceof kn||e instanceof Pn)throw e;d=hi(s)}const h=wn(e.iv),p=wn(e.tag),m=dn.encode(null!==(n=e.protected)&&void 0!==n?n:"");let g;g=void 0!==e.aad?pn(m,dn.encode("."),dn.encode(e.aad)):m;let y=await Vn(s,d,wn(e.ciphertext),h,p,g);"DEF"===o.zip&&(y=await((null==r?void 0:r.inflateRaw)||Zn)(y));const b={plaintext:y};return void 0!==e.protected&&(b.protectedHeader=i),void 0!==e.aad&&(b.additionalAuthenticatedData=wn(e.aad)),void 0!==e.unprotected&&(b.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(b.unprotectedHeader=e.header),l?{...b,key:t}:b}({ciphertext:a,iv:o||void 0,protected:n||void 0,tag:s||void 0,encrypted_key:i||void 0},t,r),f={plaintext:u.plaintext,protectedHeader:u.protectedHeader};return"function"==typeof t?{...f,key:u.key}:f}var _i=async e=>{if(e instanceof Uint8Array)return{kty:"oct",k:vn(e)};if(!un(e))throw new TypeError(Hn(e,...Wn,"Uint8Array"));if(!e.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:t,key_ops:r,alg:n,use:i,...o}=await cn.subtle.exportKey("jwk",e);return o};async function Ei(e){return _i(e)}async function Si(e,t,r,n,i={}){let o,a,s;switch(gi(e,r,"encrypt"),e){case"dir":s=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!ai(r))throw new Pn("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:c,apv:u}=i;let{epk:f}=i;f||(f=(await async function(e){if(!un(e))throw new TypeError(Hn(e,...Wn));return cn.subtle.generateKey(e.algorithm,!0,["deriveBits"])}(r)).privateKey);const{x:d,y:l,crv:h,kty:p}=await Ei(f),m=await oi(r,f,"ECDH-ES"===e?t:e,"ECDH-ES"===e?li(t):parseInt(e.slice(-5,-2),10),c,u);if(a={epk:{x:d,crv:h,kty:p}},"EC"===p&&(a.epk.y=l),c&&(a.apu=vn(c)),u&&(a.apv=vn(u)),"ECDH-ES"===e){s=m;break}s=n||hi(t);const g=e.slice(-6);o=await ni(g,m,s);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s=n||hi(t),o=await(async(e,t,r)=>{if(!un(t))throw new TypeError(Hn(t,...Wn));if(Ln(t,e,"encrypt","wrapKey"),fi(e,t),t.usages.includes("encrypt"))return new Uint8Array(await cn.subtle.encrypt(ui(e),t,r));if(t.usages.includes("wrapKey")){const n=await cn.subtle.importKey("raw",r,...ei);return new Uint8Array(await cn.subtle.wrapKey("raw",n,t,ui(e)))}throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')})(e,r,s);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{s=n||hi(t);const{p2c:c,p2s:u}=i;({encryptedKey:o,...a}=await(async(e,t,r,n=2048,i=Rn(new Uint8Array(16)))=>{const o=await si(i,e,n,t);return{encryptedKey:await ni(e.slice(-6),o,r),p2c:n,p2s:vn(i)}})(e,r,s,c,u));break}case"A128KW":case"A192KW":case"A256KW":s=n||hi(t),o=await ni(e,r,s);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{s=n||hi(t);const{iv:c}=i;({encryptedKey:o,...a}=await async function(e,t,r,n){const i=e.slice(0,7);n||(n=On(i));const{ciphertext:o,tag:a}=await yi(i,r,t,n,new Uint8Array(0));return{encryptedKey:o,iv:vn(n),tag:vn(a)}}(e,r,s,c));break}default:throw new Pn('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:s,encryptedKey:o,parameters:a}}const Pi=Symbol();class xi{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,t){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new kn("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!Qn(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new kn("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(vi(kn,new Map,null==t?void 0:t.crit,this._protectedHeader,r),void 0!==r.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new kn('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==r.zip)throw new Pn('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:n,enc:i}=r;if("string"!=typeof n||!n)throw new kn('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof i||!i)throw new kn('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let o,a,s,c,u,f,d;if("dir"===n){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===n&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let r;({cek:a,encryptedKey:o,parameters:r}=await Si(n,i,e,this._cek,this._keyManagementParameters)),r&&(t&&Pi in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...r}:this.setUnprotectedHeader(r):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...r}:this.setProtectedHeader(r))}if(this._iv||(this._iv=On(i)),c=this._protectedHeader?dn.encode(vn(JSON.stringify(this._protectedHeader))):dn.encode(""),this._aad?(u=vn(this._aad),s=pn(c,dn.encode("."),dn.encode(u))):s=c,"DEF"===r.zip){const e=await((null==t?void 0:t.deflateRaw)||Xn)(this._plaintext);({ciphertext:f,tag:d}=await yi(i,e,a,this._iv,s))}else({ciphertext:f,tag:d}=await yi(i,this._plaintext,a,this._iv,s));const l={ciphertext:vn(f),iv:vn(this._iv),tag:vn(d)};return o&&(l.encrypted_key=vn(o)),u&&(l.aad=u),this._protectedHeader&&(l.protected=ln.decode(c)),this._sharedUnprotectedHeader&&(l.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(l.header=this._unprotectedHeader),l}}function ki(e,t){const r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return Dn()&&"NODE-ED25519"===t.name?{name:"NODE-ED25519",namedCurve:"NODE-ED25519"}:{name:t.name};default:throw new Pn(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}function Mi(e,t,r){if(un(t))return Un(t,e,r),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Hn(t,...Wn));return cn.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}throw new TypeError(Hn(t,...Wn,"Uint8Array"))}const Ci=async(e,t,r,n)=>{const i=await Mi(e,t,"verify");fi(e,i);const o=ki(e,i.algorithm);try{return await cn.subtle.verify(o,i,r,n)}catch(e){return!1}};async function Ii(e,t,r){var n;if(!Yn(e))throw new Mn("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Mn('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Mn("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Mn("JWS Payload missing");if("string"!=typeof e.signature)throw new Mn("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Yn(e.header))throw new Mn("JWS Unprotected Header incorrect type");let i={};if(e.protected)try{const t=wn(e.protected);i=JSON.parse(ln.decode(t))}catch(e){throw new Mn("JWS Protected Header is invalid")}if(!Qn(i,e.header))throw new Mn("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...i,...e.header};let a=!0;if(vi(Mn,new Map([["b64",!0]]),null==r?void 0:r.crit,i,o).has("b64")&&(a=i.b64,"boolean"!=typeof a))throw new Mn('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Mn('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=r&&wi("algorithms",r.algorithms);if(c&&!c.has(s))throw new Sn('"alg" (Algorithm) Header Parameter not allowed');if(a){if("string"!=typeof e.payload)throw new Mn("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Mn("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(i,e),u=!0),gi(s,t,"verify");const f=pn(dn.encode(null!==(n=e.protected)&&void 0!==n?n:""),dn.encode("."),"string"==typeof e.payload?dn.encode(e.payload):e.payload),d=wn(e.signature);if(!await Ci(s,t,d,f))throw new In;let l;l=a?wn(e.payload):"string"==typeof e.payload?dn.encode(e.payload):e.payload;const h={payload:l};return void 0!==e.protected&&(h.protectedHeader=i),void 0!==e.header&&(h.unprotectedHeader=e.header),u?{...h,key:t}:h}var Ri=e=>Math.floor(e.getTime()/1e3);const Ni=86400,Oi=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;var Ti=e=>{const t=Oi.exec(e);if(!t)throw new TypeError("Invalid time period format");const r=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(r);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*r);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*r);case"day":case"days":case"d":return Math.round(r*Ni);case"week":case"weeks":case"w":return Math.round(604800*r);default:return Math.round(31557600*r)}};const ji=e=>e.toLowerCase().replace(/^application\//,"");var Di=(e,t,r={})=>{const{typ:n}=r;if(n&&("string"!=typeof e.typ||ji(e.typ)!==ji(n)))throw new _n('unexpected "typ" JWT header value',"typ","check_failed");let i;try{i=JSON.parse(ln.decode(t))}catch(e){}if(!Yn(i))throw new Cn("JWT Claims Set must be a top-level JSON object");const{issuer:o}=r;if(o&&!(Array.isArray(o)?o:[o]).includes(i.iss))throw new _n('unexpected "iss" claim value',"iss","check_failed");const{subject:a}=r;if(a&&i.sub!==a)throw new _n('unexpected "sub" claim value',"sub","check_failed");const{audience:s}=r;if(s&&(c=i.aud,u="string"==typeof s?[s]:s,!("string"==typeof c?u.includes(c):Array.isArray(c)&&u.some(Set.prototype.has.bind(new Set(c))))))throw new _n('unexpected "aud" claim value',"aud","check_failed");var c,u;let f;switch(typeof r.clockTolerance){case"string":f=Ti(r.clockTolerance);break;case"number":f=r.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:d}=r,l=Ri(d||new Date);if((void 0!==i.iat||r.maxTokenAge)&&"number"!=typeof i.iat)throw new _n('"iat" claim must be a number',"iat","invalid");if(void 0!==i.nbf){if("number"!=typeof i.nbf)throw new _n('"nbf" claim must be a number',"nbf","invalid");if(i.nbf>l+f)throw new _n('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==i.exp){if("number"!=typeof i.exp)throw new _n('"exp" claim must be a number',"exp","invalid");if(i.exp<=l-f)throw new En('"exp" claim timestamp check failed',"exp","check_failed")}if(r.maxTokenAge){const e=l-i.iat;if(e-f>("number"==typeof r.maxTokenAge?r.maxTokenAge:Ti(r.maxTokenAge)))throw new En('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(e<0-f)throw new _n('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return i};async function $i(e,t,r){var n;const i=await async function(e,t,r){if(e instanceof Uint8Array&&(e=ln.decode(e)),"string"!=typeof e)throw new Mn("Compact JWS must be a string or Uint8Array");const{0:n,1:i,2:o,length:a}=e.split(".");if(3!==a)throw new Mn("Invalid Compact JWS");const s=await Ii({payload:i,protected:n,signature:o},t,r),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?{...c,key:s.key}:c}(e,t,r);if((null===(n=i.protectedHeader.crit)||void 0===n?void 0:n.includes("b64"))&&!1===i.protectedHeader.b64)throw new Cn("JWTs MUST NOT use unencoded payload");const o={payload:Di(i.protectedHeader,i.payload,r),protectedHeader:i.protectedHeader};return"function"==typeof t?{...o,key:i.key}:o}class Bi{constructor(e){this._flattened=new xi(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){const r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}class Fi{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Mn("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Qn(this._protectedHeader,this._unprotectedHeader))throw new Mn("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let n=!0;if(vi(Mn,new Map([["b64",!0]]),null==t?void 0:t.crit,this._protectedHeader,r).has("b64")&&(n=this._protectedHeader.b64,"boolean"!=typeof n))throw new Mn('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:i}=r;if("string"!=typeof i||!i)throw new Mn('JWS "alg" (Algorithm) Header Parameter missing or invalid');gi(i,e,"sign");let o,a=this._payload;n&&(a=dn.encode(vn(a))),o=this._protectedHeader?dn.encode(vn(JSON.stringify(this._protectedHeader))):dn.encode("");const s=pn(o,dn.encode("."),a),c=await(async(e,t,r)=>{const n=await Mi(e,t,"sign");fi(e,n);const i=await cn.subtle.sign(ki(e,n.algorithm),n,r);return new Uint8Array(i)})(i,e,s),u={signature:vn(c),payload:""};return n&&(u.payload=ln.decode(a)),this._unprotectedHeader&&(u.header=this._unprotectedHeader),this._protectedHeader&&(u.protected=ln.decode(o)),u}}class zi{constructor(e){this._flattened=new Fi(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}class Ui{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}class Li{constructor(e){this._signatures=[],this._payload=e}addSignature(e,t){const r=new Ui(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new Mn("at least one signature must be added");const e={signatures:[],payload:""};for(let t=0;t>3));case"A128KW":case"A192KW":case"A256KW":n=parseInt(e.slice(1,4),10),i={name:"AES-KW",length:n},o=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":n=parseInt(e.slice(1,4),10),i={name:"AES-GCM",length:n},o=["encrypt","decrypt"];break;default:throw new Pn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return cn.subtle.generateKey(i,null!==(r=null==t?void 0:t.extractable)&&void 0!==r&&r,o)}(e,t)}async function Wi(e,t){const r=void 0===t?e.alg:t,n=nn.concat(rn).concat(on);if(!n.includes(r))throw new an("invalid alg. Must be one of: "+n.join(","),["invalid algorithm"]);try{const r=await mi(e,t);if(null==r)throw new an(new Error("failed importing keys"),["invalid key"]);return r}catch(e){throw new an(e,["invalid key"])}}async function Gi(e,t,r){let n,i;const o={...t};if(nn.includes(t.alg))n="dir",i=void 0!==r?r:t.alg;else{if(!rn.concat(on).includes(t.alg))throw new an(`Not a valid symmetric or assymetric alg: ${t.alg}`,["encryption failed","invalid key","invalid algorithm"]);if(void 0===r)throw new an("An encryption algorith encAlg for content encryption should be provided. Allowed values are: "+nn.join(","),["encryption failed"]);i=r,n="ECDH-ES",o.alg=n}const a=await Wi(o);let s;try{return s=await new Bi(e).setProtectedHeader({alg:n,enc:i,kid:t.kid}).encrypt(a),s}catch(e){throw new an(e,["encryption failed"])}}async function Vi(e,t){try{const r={...t},{alg:n,enc:i}=function(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(ln.decode(Ki(t)));if(!Yn(e))throw new Error;return e}catch(e){throw new TypeError("Invalid Token or Protected Header formatting")}}(e);if(void 0===n||void 0===i)throw new an("missing enc or alg in jwe header",["invalid format"]);"ECDH-ES"===n&&(r.alg=n);const o=await Wi(r);return await Ai(e,o,{contentEncryptionAlgorithms:[i]})}catch(e){throw new an(e,["decryption failed"])}}async function Zi(e,t){const r=e.match(/^([a-zA-Z0-9_-]+)\.{1,2}([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)$/);if(null===r)throw new an(new Error(`${e} is not a JWS`),["not a compact jws"]);let n,o;try{n=JSON.parse(i(r[1],!0)),o=JSON.parse(i(r[2],!0))}catch(e){throw new an(e,["invalid format","not a compact jws"])}if(void 0!==t){const r="function"==typeof t?await t(n,o):t,i=await Wi(r);try{const t=await $i(e,i);return{header:t.protectedHeader,payload:t.payload,signer:r}}catch(e){throw new an(e,["jws verification failed"])}}return{header:n,payload:o}}function Xi(e){if(nn.concat(tn).concat(rn).includes(e))return Number(e.match(/\d{3}/)[0])/8;throw new an("unsupported algorithm",["invalid algorithm"])}async function Qi(e,t,r){let n;if(!nn.includes(e))throw new an(new Error(`Invalid encAlg '${e}'. Supported values are: ${nn.toString()}`),["invalid algorithm"]);const c=Xi(e);if(void 0!==t){if("string"==typeof t)if(!0===r)n=i(t);else{const e=o(t,!1);if(e!==o(t,!1,c))throw new an(new RangeError(`Expected hex length ${2*c} does not meet provided one ${e.length/2}`),["invalid key"]);n=new Uint8Array(s(t))}else n=t;if(n.length!==c)throw new an(new RangeError(`Expected secret length ${c} does not meet provided one ${n.length}`),["invalid key"])}else try{n=await Ji(e,{extractable:!0})}catch(e){throw new an(e,["unexpected error"])}const u=await Ei(n);return u.alg=e,{jwk:u,hex:a(i(u.k),!1,c)}}async function Yi(e,t){if(void 0===e.alg||void 0===t.alg||e.alg!==t.alg)throw new Error("alg no present in either pubJwk or privJwk, or pubJWK.alg != privJWK.alg");const r=await Wi(e),n=await Wi(t);try{const e=await c(16),i=await new Li(e).addSignature(n).setProtectedHeader({alg:t.alg}).sign();await async function(e,t,r){if(!Yn(e))throw new Mn("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(Yn))throw new Mn("JWS Signatures missing or incorrect type");for(const n of e.signatures)try{return await Ii({header:n.header,payload:e.payload,protected:n.protected,signature:n.signature},t,r)}catch(e){}throw new In}(i,r)}catch(e){throw new an(e,["unexpected error"])}}function eo(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function to(e){return eo(e)||Array.isArray(e)?Array.isArray(e)?e.map((e=>Array.isArray(e)||eo(e)?to(e):e)):Object.keys(e).sort().map((t=>[t,to(e[t])])):e}function ro(e){return JSON.stringify(to(e))}function no(e,t,r,n=2e3){if(er+n)throw new an(new Error(`timestamp ${new Date(e).toTimeString()} after 'notAfter' ${new Date(r).toTimeString()} with tolerance of ${n/1e3}s`),["invalid timestamp"])}function io(e){return Array.isArray(e)?e.sort().map(io):(t=e,"[object Object]"===Object.prototype.toString.call(t)?Object.keys(e).sort().reduce((function(t,r){return t[r]=io(e[r]),t}),{}):e);var t}function oo(e,t=!1,r){try{return o(e,t,r)}catch(e){throw new an(e,["invalid format"])}}async function ao(e,t){try{await Wi(e,e.alg);const r=io(e);return t?JSON.stringify(r):r}catch(e){throw new an(e,["invalid key"])}}async function so(e,t){const r=tn;if(!r.includes(t))throw new an(new RangeError(`Valid hash algorith values are any of ${JSON.stringify(r)}`),["invalid algorithm"]);const n=new TextEncoder,i="string"==typeof e?n.encode(e).buffer:e;try{let e;return e=new Uint8Array(await crypto.subtle.digest(t,i)),e}catch(e){throw new an(e,["unexpected error"])}}var co={exports:{}};!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:g.Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],f=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(e);n=(p=p.idivn(f)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,d=67108863&c,l=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=l;h++){var p=u-h|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,A=v>>>13,_=0|a[4],E=8191&_,S=_>>>13,P=0|a[5],x=8191&P,k=P>>>13,M=0|a[6],C=8191&M,I=M>>>13,R=0|a[7],N=8191&R,O=R>>>13,T=0|a[8],j=8191&T,D=T>>>13,$=0|a[9],B=8191&$,F=$>>>13,z=0|s[0],U=8191&z,L=z>>>13,q=0|s[1],H=8191&q,K=q>>>13,J=0|s[2],W=8191&J,G=J>>>13,V=0|s[3],Z=8191&V,X=V>>>13,Q=0|s[4],Y=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,fe=0|s[8],de=8191&fe,le=fe>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(u+(n=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,L))+Math.imul(l,U)|0))<<13)|0;u=((o=Math.imul(l,L))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,L))+Math.imul(m,U)|0,o=Math.imul(m,L);var ye=(u+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(l,H)|0))<<13)|0;u=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,U),i=(i=Math.imul(y,L))+Math.imul(b,U)|0,o=Math.imul(b,L),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,K)|0;var be=(u+(n=n+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(l,W)|0))<<13)|0;u=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,L))+Math.imul(A,U)|0,o=Math.imul(A,L),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,G)|0;var ve=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,Z)|0))<<13)|0;u=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,L))+Math.imul(S,U)|0,o=Math.imul(S,L),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,X)|0;var we=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Y)|0))<<13)|0;u=((o=o+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,L))+Math.imul(k,U)|0,o=Math.imul(k,L),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,ee)|0;var Ae=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((o=o+Math.imul(l,ne)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,L))+Math.imul(I,U)|0,o=Math.imul(I,L),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,K)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var _e=(u+(n=n+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(l,oe)|0))<<13)|0;u=((o=o+Math.imul(l,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,L))+Math.imul(O,U)|0,o=Math.imul(O,L),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,ce)|0))<<13)|0;u=((o=o+Math.imul(l,ue)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,L))+Math.imul(D,U)|0,o=Math.imul(D,L),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(O,H)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,X)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var Se=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((o=o+Math.imul(l,le)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(B,U),i=(i=Math.imul(B,L))+Math.imul(F,U)|0,o=Math.imul(F,L),n=n+Math.imul(j,H)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,K)|0,n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,le)|0;var Pe=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,pe)|0))<<13)|0;u=((o=o+Math.imul(l,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(B,H),i=(i=Math.imul(B,K))+Math.imul(F,H)|0,o=Math.imul(F,K),n=n+Math.imul(j,W)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(N,Z)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(b,de)|0,o=o+Math.imul(b,le)|0;var xe=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,G))+Math.imul(F,W)|0,o=Math.imul(F,G),n=n+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,n=n+Math.imul(E,ce)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(S,ce)|0,o=o+Math.imul(S,ue)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,le)|0;var ke=(u+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(B,Z),i=(i=Math.imul(B,X))+Math.imul(F,Z)|0,o=Math.imul(F,X),n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(k,ce)|0,o=o+Math.imul(k,ue)|0,n=n+Math.imul(E,de)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,le)|0;var Me=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(B,Y),i=(i=Math.imul(B,ee))+Math.imul(F,Y)|0,o=Math.imul(F,ee),n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ne)|0,n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(I,ce)|0,o=o+Math.imul(I,ue)|0,n=n+Math.imul(x,de)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,le)|0;var Ce=(u+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;u=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(B,re),i=(i=Math.imul(B,ne))+Math.imul(F,re)|0,o=Math.imul(F,ne),n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,n=n+Math.imul(N,ce)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(C,de)|0,i=(i=i+Math.imul(C,le)|0)+Math.imul(I,de)|0,o=o+Math.imul(I,le)|0;var Ie=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(k,pe)|0))<<13)|0;u=((o=o+Math.imul(k,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),n=n+Math.imul(j,ce)|0,i=(i=i+Math.imul(j,ue)|0)+Math.imul(D,ce)|0,o=o+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,le)|0;var Re=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(I,pe)|0))<<13)|0;u=((o=o+Math.imul(I,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(B,ce),i=(i=Math.imul(B,ue))+Math.imul(F,ce)|0,o=Math.imul(F,ue),n=n+Math.imul(j,de)|0,i=(i=i+Math.imul(j,le)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,le)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(B,de),i=(i=Math.imul(B,le))+Math.imul(F,de)|0,o=Math.imul(F,le);var Oe=(u+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,me)|0)+Math.imul(D,pe)|0))<<13)|0;u=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Te=(u+(n=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,me))+Math.imul(F,pe)|0))<<13)|0;return u=((o=Math.imul(F,me))+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,c[0]=ge,c[1]=ye,c[2]=be,c[3]=ve,c[4]=we,c[5]=Ae,c[6]=_e,c[7]=Ee,c[8]=Se,c[9]=Pe,c[10]=xe,c[11]=ke,c[12]=Me,c[13]=Ce,c[14]=Ie,c[15]=Re,c[16]=Ne,c[17]=Oe,c[18]=Te,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(e,t,r){return y(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?y(this,e,t):b(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),b(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==f||u>=i);u--){var d=0|this.words[u];this.words[u]=f<<26-o|d>>>o,f=d&s}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;d--){var l=67108864*(0|n.words[o.length+d])+(0|n.words[o.length+d-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var l=0,h=1;0==(t.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(f),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(f),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,l=1;0==(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new P(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function A(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function P(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){P.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(A,w),A.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},A.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new A;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return v[e]=t,t},P.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},P.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},P.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},P.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},P.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},P.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},P.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},P.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},P.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},P.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},P.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},P.prototype.isqr=function(e){return this.imul(e,e.clone())},P.prototype.sqr=function(e){return this.mul(e,e)},P.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var d=this.pow(f,o),l=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var d=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},P.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},P.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new x(e)},n(x,P),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,u)}(co);var uo=f(co.exports);let fo=!1,lo=!1;const ho={debug:1,default:2,info:2,warning:3,error:4,off:5};let po=ho.default,mo=null;const go=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var yo,bo;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(yo||(yo={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(bo||(bo={}));const vo="0123456789abcdef";class wo{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==ho[r]&&this.throwArgumentError("invalid log level name","logLevel",e),po>ho[r]||console.log.apply(console,t)}debug(...e){this._log(wo.levels.DEBUG,e)}info(...e){this._log(wo.levels.INFO,e)}warn(...e){this._log(wo.levels.WARNING,e)}makeError(e,t,r){if(lo)return this.makeError("censored error",t,{});t||(t=wo.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=vo[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case bo.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case bo.CALL_EXCEPTION:case bo.INSUFFICIENT_FUNDS:case bo.MISSING_NEW:case bo.NONCE_EXPIRED:case bo.REPLACEMENT_UNDERPRICED:case bo.TRANSACTION_REPLACED:case bo.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,wo.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){go&&this.throwError("platform missing String.prototype.normalize",wo.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:go})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,wo.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,wo.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,wo.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",wo.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",wo.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",wo.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return mo||(mo=new wo("logger/5.7.0")),mo}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",wo.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),fo){if(!e)return;this.globalLogger().throwError("error censorship permanent",wo.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}lo=!!e,fo=!!t}static setLogLevel(e){const t=ho[e.toLowerCase()];null!=t?po=t:wo.globalLogger().warn("invalid log level - "+e)}static from(e){return new wo(e)}}wo.errors=bo,wo.levels=yo;var Ao=Object.freeze({__proto__:null,get ErrorCode(){return bo},get LogLevel(){return yo},Logger:wo});const _o=new wo("bytes/5.7.0");function Eo(e){return!!e.toHexString}function So(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return So(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Po(e){return No(e)&&!(e.length%2)||ko(e)}function xo(e){return"number"==typeof e&&e==e&&e%1==0}function ko(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!xo(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function Mo(e,t){if(t||(t={}),"number"==typeof e){_o.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),So(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Eo(e)&&(e=e.toHexString()),No(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":_o.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;eMo(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),So(n)}function Io(e){let t=Mo(e);if(0===t.length)return t;let r=0;for(;rt&&_o.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),So(r)}function No(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Oo="0123456789abcdef";function To(e,t){if(t||(t={}),"number"==typeof e){_o.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Oo[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Eo(e))return e.toHexString();if(No(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":_o.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(ko(e)){let t="0x";for(let r=0;r>4]+Oo[15&n]}return t}return _o.throwArgumentError("invalid hexlify value","value",e)}function jo(e){if("string"!=typeof e)e=To(e);else if(!No(e)||e.length%2)return null;return(e.length-2)/2}function Do(e,t,r){return"string"!=typeof e?e=To(e):(!No(e)||e.length%2)&&_o.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function $o(e){let t="0x";return e.forEach((e=>{t+=To(e).substring(2)})),t}function Bo(e){const t=Fo(To(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Fo(e){"string"!=typeof e&&(e=To(e)),No(e)||_o.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&_o.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Uo(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Po(e)){let r=Mo(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=To(r.slice(0,32)),t.s=To(r.slice(32,64))):65===r.length?(t.r=To(r.slice(0,32)),t.s=To(r.slice(32,64)),t.v=r[64]):_o.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:_o.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=To(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=Ro(Mo(t._vs),32);t._vs=To(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&_o.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=To(r);null==t.s?t.s=i:t.s!==i&&_o.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?_o.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&_o.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&No(t.r)?t.r=zo(t.r,32):_o.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&No(t.s)?t.s=zo(t.s,32):_o.throwArgumentError("signature missing or invalid s","signature",e);const r=Mo(t.s);r[0]>=128&&_o.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=To(r);t._vs&&(No(t._vs)||_o.throwArgumentError("signature invalid _vs","signature",e),t._vs=zo(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&_o.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Lo(e){return To(Co([(e=Uo(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var qo=Object.freeze({__proto__:null,arrayify:Mo,concat:Co,hexConcat:$o,hexDataLength:jo,hexDataSlice:Do,hexStripZeros:Fo,hexValue:Bo,hexZeroPad:zo,hexlify:To,isBytes:ko,isBytesLike:Po,isHexString:No,joinSignature:Lo,splitSignature:Uo,stripZeros:Io,zeroPad:Ro});const Ho="bignumber/5.7.0";var Ko=uo.BN;const Jo=new wo(Ho),Wo={},Go=9007199254740991;let Vo=!1;class Zo{constructor(e,t){e!==Wo&&Jo.throwError("cannot call constructor directly; use BigNumber.from",wo.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Qo(Yo(this).fromTwos(e))}toTwos(e){return Qo(Yo(this).toTwos(e))}abs(){return"-"===this._hex[0]?Zo.from(this._hex.substring(1)):this}add(e){return Qo(Yo(this).add(Yo(e)))}sub(e){return Qo(Yo(this).sub(Yo(e)))}div(e){return Zo.from(e).isZero()&&ea("division-by-zero","div"),Qo(Yo(this).div(Yo(e)))}mul(e){return Qo(Yo(this).mul(Yo(e)))}mod(e){const t=Yo(e);return t.isNeg()&&ea("division-by-zero","mod"),Qo(Yo(this).umod(t))}pow(e){const t=Yo(e);return t.isNeg()&&ea("negative-power","pow"),Qo(Yo(this).pow(t))}and(e){const t=Yo(e);return(this.isNegative()||t.isNeg())&&ea("unbound-bitwise-result","and"),Qo(Yo(this).and(t))}or(e){const t=Yo(e);return(this.isNegative()||t.isNeg())&&ea("unbound-bitwise-result","or"),Qo(Yo(this).or(t))}xor(e){const t=Yo(e);return(this.isNegative()||t.isNeg())&&ea("unbound-bitwise-result","xor"),Qo(Yo(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ea("negative-width","mask"),Qo(Yo(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ea("negative-width","shl"),Qo(Yo(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ea("negative-width","shr"),Qo(Yo(this).shrn(e))}eq(e){return Yo(this).eq(Yo(e))}lt(e){return Yo(this).lt(Yo(e))}lte(e){return Yo(this).lte(Yo(e))}gt(e){return Yo(this).gt(Yo(e))}gte(e){return Yo(this).gte(Yo(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Yo(this).isZero()}toNumber(){try{return Yo(this).toNumber()}catch(e){ea("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Jo.throwError("this platform does not support BigInt",wo.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Vo||(Vo=!0,Jo.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Jo.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",wo.errors.UNEXPECTED_ARGUMENT,{}):Jo.throwError("BigNumber.toString does not accept parameters",wo.errors.UNEXPECTED_ARGUMENT,{})),Yo(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Zo)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new Zo(Wo,Xo(e)):e.match(/^-?[0-9]+$/)?new Zo(Wo,Xo(new Ko(e))):Jo.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&ea("underflow","BigNumber.from",e),(e>=Go||e<=-Go)&&ea("overflow","BigNumber.from",e),Zo.from(String(e));const t=e;if("bigint"==typeof t)return Zo.from(t.toString());if(ko(t))return Zo.from(To(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return Zo.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(No(e)||"-"===e[0]&&No(e.substring(1))))return Zo.from(e)}return Jo.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Xo(e){if("string"!=typeof e)return Xo(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Jo.throwArgumentError("invalid hex","value",e),"0x00"===(e=Xo(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Qo(e){return Zo.from(Xo(e))}function Yo(e){const t=Zo.from(e).toHexString();return"-"===t[0]?new Ko("-"+t.substring(3),16):new Ko(t.substring(2),16)}function ea(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Jo.throwError(e,wo.errors.NUMERIC_FAULT,n)}const ta=new wo(Ho),ra={},na=Zo.from(0),ia=Zo.from(-1);function oa(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),ta.throwError(e,wo.errors.NUMERIC_FAULT,i)}let aa="0";for(;aa.length<256;)aa+=aa;function sa(e){if("number"!=typeof e)try{e=Zo.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+aa.substring(0,e):ta.throwArgumentError("invalid decimal size","decimals",e)}function ca(e,t){null==t&&(t=0);const r=sa(t),n=(e=Zo.from(e)).lt(na);n&&(e=e.mul(ia));let i=e.mod(r).toString();for(;i.length2&&ta.throwArgumentError("too many decimal points","value",e);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>r.length-1&&oa("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==e[t]?n:(typeof e[t]!==r&&ta.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&ta.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&ta.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new fa(ra,t,r,n)}}class da{constructor(e,t,r,n){e!==ra&&ta.throwError("cannot use FixedNumber constructor; use FixedNumber.from",wo.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&ta.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ua(this._value,this.format.decimals),r=ua(e._value,e.format.decimals);return da.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ua(this._value,this.format.decimals),r=ua(e._value,e.format.decimals);return da.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ua(this._value,this.format.decimals),r=ua(e._value,e.format.decimals);return da.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ua(this._value,this.format.decimals),r=ua(e._value,e.format.decimals);return da.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=da.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(la.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=da.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(la.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&ta.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=da.from("1"+aa.substring(0,e),this.format),n=ha.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&ta.throwArgumentError("invalid byte width","width",e);return zo(Zo.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return da.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Zo.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||No(e)||"bigint"==typeof e||ko(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),da.fromString(ca(e,t),fa.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=fa.from(t),n=ua(e,r.decimals);!r.signed&&n.lt(na)&&oa("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=zo(i,r.width/8));const o=ca(n,r.decimals);return new da(ra,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=fa.from(t);if(Mo(e).length>r.width/8)throw new Error("overflow");let n=Zo.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=ca(n,r.decimals);return new da(ra,i,o,r)}static from(e,t){if("string"==typeof e)return da.fromString(e,t);if(ko(e))return da.fromBytes(e,t);try{return da.fromValue(e,0,t)}catch(e){if(e.code!==wo.errors.INVALID_ARGUMENT)throw e}return ta.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const la=da.from(1),ha=da.from("0.5");var pa=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const ma=new wo("properties/5.7.0");function ga(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function ya(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function ba(e){return pa(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function va(e,t){e&&"object"==typeof e||ma.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ma.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function wa(e){const t={};for(const r in e)t[r]=e[r];return t}const Aa={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function _a(e){if(null==e||Aa[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;rSa(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ga(t,r,Sa(n))}return t}return ma.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Sa(e){return Ea(e)}class Pa{constructor(e){for(const t in e)this[t]=Sa(e[t])}}var xa=Object.freeze({__proto__:null,Description:Pa,checkProperties:va,deepCopy:Sa,defineReadOnly:ga,getStatic:ya,resolveProperties:ba,shallowCopy:wa});const ka="abi/5.7.0",Ma=new wo(ka),Ca={};let Ia={calldata:!0,memory:!0,storage:!0},Ra={calldata:!0,memory:!0};function Na(e,t){if("bytes"===e||"string"===e){if(Ia[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ra[t])return!0;return(Ia[t]||"payable"===t)&&Ma.throwArgumentError("invalid modifier","name",t),!1}function Oa(e,t){for(let r in t)ga(e,r,t[r])}const Ta=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ja=new RegExp(/^(.*)\[([0-9]*)\]$/);class Da{constructor(e,t){e!==Ca&&Ma.throwError("use fromString",wo.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Oa(this,t);let r=this.type.match(ja);Oa(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Da.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Ta.sighash),Ta[e]||Ma.throwArgumentError("invalid format type","format",e),e===Ta.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Ta.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ta.full?", ":",")+")"):t+=this.type,e!==Ta.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ta.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Da.fromString(e,t):Da.fromObject(e)}static fromObject(e){return Da.isParamType(e)?e:new Da(Ca,{name:e.name||null,type:Wa(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Da.fromObject):null})}static fromString(e,t){return r=function(e,t){let r=e;function n(t){Ma.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let r=0;rDa.fromString(e,t)))}class Ba{constructor(e,t){e!==Ca&&Ma.throwError("use a static from method",wo.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Oa(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Ba.isFragment(e)?e:"string"==typeof e?Ba.fromString(e):Ba.fromObject(e)}static fromObject(e){if(Ba.isFragment(e))return e;switch(e.type){case"function":return Ha.fromObject(e);case"event":return Fa.fromObject(e);case"constructor":return qa.fromObject(e);case"error":return Ja.fromObject(e);case"fallback":case"receive":return null}return Ma.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Fa.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ha.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?qa.fromString(e.trim()):"error"===e.split(" ")[0]?Ja.fromString(e.substring(5).trim()):Ma.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Fa extends Ba{format(e){if(e||(e=Ta.sighash),Ta[e]||Ma.throwArgumentError("invalid format type","format",e),e===Ta.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ta.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ta.full?", ":",")+") ",e!==Ta.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Fa.fromString(e):Fa.fromObject(e)}static fromObject(e){if(Fa.isEventFragment(e))return e;"event"!==e.type&&Ma.throwArgumentError("invalid event object","value",e);const t={name:Va(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Da.fromObject):[],type:"event"};return new Fa(Ca,t)}static fromString(e){let t=e.match(Za);t||Ma.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:Ma.warn("unknown modifier: "+e)}})),Fa.fromObject({name:t[1].trim(),anonymous:r,inputs:$a(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function za(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&Ma.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||Ma.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Zo.from(r[1]),r[0]):e}function Ua(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function La(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Ma.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Ma.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Ma.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Ma.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Ma.throwArgumentError("unable to determine stateMutability","value",e),t}class qa extends Ba{format(e){if(e||(e=Ta.sighash),Ta[e]||Ma.throwArgumentError("invalid format type","format",e),e===Ta.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===Ta.sighash&&Ma.throwError("cannot format a constructor for sighash",wo.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ta.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?qa.fromString(e):qa.fromObject(e)}static fromObject(e){if(qa.isConstructorFragment(e))return e;"constructor"!==e.type&&Ma.throwArgumentError("invalid constructor object","value",e);let t=La(e);t.constant&&Ma.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Da.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Zo.from(e.gas):null};return new qa(Ca,r)}static fromString(e){let t={type:"constructor"},r=(e=za(e,t)).match(Za);return r&&"constructor"===r[1].trim()||Ma.throwArgumentError("invalid constructor string","value",e),t.inputs=$a(r[2].trim(),!1),Ua(r[3].trim(),t),qa.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Ha extends qa{format(e){if(e||(e=Ta.sighash),Ta[e]||Ma.throwArgumentError("invalid format type","format",e),e===Ta.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ta.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ta.full?", ":",")+") ",e!==Ta.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?Ha.fromString(e):Ha.fromObject(e)}static fromObject(e){if(Ha.isFunctionFragment(e))return e;"function"!==e.type&&Ma.throwArgumentError("invalid function object","value",e);let t=La(e);const r={type:e.type,name:Va(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Da.fromObject):[],outputs:e.outputs?e.outputs.map(Da.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Zo.from(e.gas):null};return new Ha(Ca,r)}static fromString(e){let t={type:"function"},r=(e=za(e,t)).split(" returns ");r.length>2&&Ma.throwArgumentError("invalid function string","value",e);let n=r[0].match(Za);if(n||Ma.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&Va(t.name),t.inputs=$a(n[2],!1),Ua(n[3].trim(),t),r.length>1){let n=r[1].match(Za);""==n[1].trim()&&""==n[3].trim()||Ma.throwArgumentError("unexpected tokens","value",e),t.outputs=$a(n[2],!1)}else t.outputs=[];return Ha.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Ka(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Ma.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Ja extends Ba{format(e){if(e||(e=Ta.sighash),Ta[e]||Ma.throwArgumentError("invalid format type","format",e),e===Ta.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ta.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ta.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Ja.fromString(e):Ja.fromObject(e)}static fromObject(e){if(Ja.isErrorFragment(e))return e;"error"!==e.type&&Ma.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Va(e.name),inputs:e.inputs?e.inputs.map(Da.fromObject):[]};return Ka(new Ja(Ca,t))}static fromString(e){let t={type:"error"},r=e.match(Za);return r||Ma.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Va(t.name),t.inputs=$a(r[2],!1),Ka(Ja.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function Wa(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Ga=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Va(e){return e&&e.match(Ga)||Ma.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Za=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Xa=new wo(ka);function Qa(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const o=e.slice();o.push(i);try{r(o,n[i])}catch(e){t.push({path:o,error:e})}}};return r([],e),t}class Ya{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Xa.throwArgumentError(e,this.localName,t)}}class es{constructor(e){ga(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return $o(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Co(e._data))}writeBytes(e){let t=Mo(e);const r=t.length%this.wordSize;return r&&(t=Co([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=Mo(Zo.from(e));return t.length>this.wordSize&&Xa.throwError("value out-of-bounds",wo.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Co([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class ts{constructor(e,t,r,n){ga(this,"_data",Mo(e)),ga(this,"wordSize",t||32),ga(this,"_coerceFunc",r),ga(this,"allowLoose",n),this._offset=0}get data(){return To(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):ts.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:Xa.throwError("data out-of-bounds",wo.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new ts(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Zo.from(this.readBytes(this.wordSize))}}var rs={exports:{}}; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */!function(e){!function(){var t="input is invalid type",r="object"==typeof window,n=r?window:{};n.JS_SHA3_NO_WINDOW&&(r=!1);var i=!r&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?n=u:i&&(n=self);var o=!n.JS_SHA3_NO_COMMON_JS&&e.exports,a=!n.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),c=[4,1024,262144,67108864],f=[0,8,16,24],d=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],h=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!n.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var g=function(e,t,r){return function(n){return new R(e,t,e).update(n)[r]()}},y=function(e,t,r){return function(n,i){return new R(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,o){return E["cshake"+e].update(t,n,i,o)[r]()}},v=function(e,t,r){return function(t,n,i,o){return E["kmac"+e].update(t,n,i,o)[r]()}},w=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function N(e,t,r){R.call(this,e,t,r)}R.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var i,o,s=this.blocks,c=this.byteCount,u=e.length,d=this.blockCount,l=0,h=this.s;l>2]|=e[l]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=c){for(this.start=i-c,this.block=s[d],i=0;i>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},R.prototype.encodeString=function(e){var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var i=0,o=e.length;if(r)i=o;else for(var s=0;s=57344?i+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},R.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(O(r),o=0)}return i&&(e=r[o],c+=s[e>>4&15]+s[15&e],i>1&&(c+=s[e>>12&15]+s[e>>8&15]),i>2&&(c+=s[e>>20&15]+s[e>>16&15])),c},R.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&O(n)}return o&&(e=s<<2,t=n[a],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},N.prototype=new R,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var O=function(e){var t,r,n,i,o,a,s,c,u,f,l,h,p,m,g,y,b,v,w,A,_,E,S,P,x,k,M,C,I,R,N,O,T,j,D,$,B,F,z,U,L,q,H,K,J,W,G,V,Z,X,Q,Y,ee,te,re,ne,ie,oe,ae,se,ce,ue,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|u>>>31),r=o^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=u^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],g=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,C=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,q=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,V=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,$=e[14]<<6|e[15]>>>26,B=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,O=e[45]<<29|e[44]>>>3,T=e[44]<<29|e[45]>>>3,P=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,z=e[27]<<25|e[26]>>>7,A=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Y=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,J=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,M=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,U=e[38]<<8|e[39]>>>24,L=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=m^~y&v,e[1]=g^~b&w,e[10]=P^~k&C,e[11]=x^~M&I,e[20]=j^~$&F,e[21]=D^~B&z,e[30]=K^~W&V,e[31]=J^~G&Z,e[40]=te^~ne&oe,e[41]=re^~ie&ae,e[2]=y^~v&A,e[3]=b^~w&_,e[12]=k^~C&R,e[13]=M^~I&N,e[22]=$^~F&U,e[23]=B^~z&L,e[32]=W^~V&X,e[33]=G^~Z&Q,e[42]=ne^~oe&se,e[43]=ie^~ae&ce,e[4]=v^~A&E,e[5]=w^~_&S,e[14]=C^~R&O,e[15]=I^~N&T,e[24]=F^~U&q,e[25]=z^~L&H,e[34]=V^~X&Y,e[35]=Z^~Q&ee,e[44]=oe^~se&ue,e[45]=ae^~ce&fe,e[6]=A^~E&m,e[7]=_^~S&g,e[16]=R^~O&P,e[17]=N^~T&x,e[26]=U^~q&j,e[27]=L^~H&D,e[36]=X^~Y&K,e[37]=Q^~ee&J,e[46]=se^~ue&te,e[47]=ce^~fe&re,e[8]=E^~m&y,e[9]=S^~g&b,e[18]=O^~P&k,e[19]=T^~x&M,e[28]=q^~j&$,e[29]=H^~D&B,e[38]=Y^~K&W,e[39]=ee^~J&G,e[48]=ue^~te&ne,e[49]=fe^~re&ie,e[0]^=d[n],e[1]^=d[n+1]};if(o)e.exports=E;else for(P=0;P>=8;return t}function cs(e,t,r){let n=0;for(let i=0;it+1+n&&as.throwError("child data too short",wo.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function ls(e,t){if(0===e.length&&as.throwError("data too short",wo.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&as.throwError("data short segment too short",wo.errors.BUFFER_OVERRUN,{});const n=cs(e,t+1,r);return t+1+r+n>e.length&&as.throwError("data long segment too short",wo.errors.BUFFER_OVERRUN,{}),ds(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&as.throwError("data array too short",wo.errors.BUFFER_OVERRUN,{}),ds(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&as.throwError("data array too short",wo.errors.BUFFER_OVERRUN,{});const n=cs(e,t+1,r);t+1+r+n>e.length&&as.throwError("data array too short",wo.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:To(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&as.throwError("data too short",wo.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:To(e.slice(t+1,t+1+r))}}return{consumed:1,result:To(e[t])}}function hs(e){const t=Mo(e),r=ls(t,0);return r.consumed!==t.length&&as.throwArgumentError("invalid rlp data","data",e),r.result}var ps=Object.freeze({__proto__:null,decode:hs,encode:fs});const ms=new wo("address/5.7.0");function gs(e){No(e,20)||ms.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=Mo(is(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const ys={};for(let e=0;e<10;e++)ys[String(e)]=String(e);for(let e=0;e<26;e++)ys[String.fromCharCode(65+e)]=String(10+e);const bs=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function vs(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>ys[e])).join("");for(;t.length>=bs;){let e=t.substring(0,bs);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function ws(e){let t=null;if("string"!=typeof e&&ms.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=gs(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&ms.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==vs(e)&&ms.throwArgumentError("bad icap checksum","address",e),r=e.substring(4),t=new Ko(r,36).toString(16);t.length<40;)t="0"+t;t=gs("0x"+t)}else ms.throwArgumentError("invalid address","address",e);var r;return t}function As(e){let t=null;try{t=ws(e.from)}catch(t){ms.throwArgumentError("missing from address","transaction",e)}return ws(Do(is(fs([t,Io(Mo(Zo.from(e.nonce).toHexString()))])),12))}var _s=Object.freeze({__proto__:null,getAddress:ws,getContractAddress:As,getCreate2Address:function(e,t,r){return 32!==jo(t)&&ms.throwArgumentError("salt must be 32 bytes","salt",t),32!==jo(r)&&ms.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),ws(Do(is(Co(["0xff",ws(e),t,r])),12))},getIcapAddress:function(e){let t=(r=ws(e).substring(2),new Ko(r,16).toString(36)).toUpperCase();for(var r;t.length<30;)t="0"+t;return"XE"+vs("XE00"+t)+t},isAddress:function(e){try{return ws(e),!0}catch(e){}return!1}});class Es extends Ya{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=ws(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return ws(zo(e.readValue().toHexString(),20))}}class Ss extends Ya{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Ps=new wo(ka);function xs(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let e={};n=t.map((t=>{const n=t.localName;return n||Ps.throwError("cannot encode object for signature with missing names",wo.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&Ps.throwError("cannot encode object for signature with duplicate names",wo.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else Ps.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&Ps.throwArgumentError("types/value length mismatch","tuple",r);let i=new es(e.wordSize),o=new es(e.wordSize),a=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=o.length;e.encode(o,r);let n=i.writeUpdatableValue();a.push((e=>{n(e+t)}))}else e.encode(i,r)})),a.forEach((e=>{e(i.length)}));let s=e.appendWriter(i);return s+=e.appendWriter(o),s}function ks(e,t){let r=[],n=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let r=e.readValue(),o=n.subReader(r.toNumber());try{i=t.decode(o)}catch(e){if(e.code===wo.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===wo.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&r.push(i)}));const i=t.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach(((e,t)=>{let n=e.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[t];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let e=0;e{throw t}})}return Object.freeze(r)}class Ms extends Ya{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Ps.throwError("insufficient data length",wo.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e>6==2;n++)e++;return e}return e===Ls.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Us||(Us={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Ls||(Ls={}));const Hs=Object.freeze({error:function(e,t,r,n,i){return zs.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:qs,replace:function(e,t,r,n,i){return e===Ls.OVERLONG?(n.push(i),0):(n.push(65533),qs(e,t,r))}});function Ks(e,t){null==t&&(t=Hs.error),e=Mo(e);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?Ls.UNEXPECTED_CONTINUE:Ls.BAD_PREFIX,n-1,e,r);continue}o=3,a=65535}if(n-1+o>=e.length){n+=t(Ls.OVERRUN,n-1,e,r);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=t(Ls.OUT_OF_RANGE,n-1-o,e,r,s):s>=55296&&s<=57343?n+=t(Ls.UTF16_SURROGATE,n-1-o,e,r,s):s<=a?n+=t(Ls.OVERLONG,n-1-o,e,r,s):r.push(s))}return r}function Js(e,t=Us.current){t!=Us.current&&(zs.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Mo(r)}function Ws(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function Gs(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function Vs(e,t){return Gs(Ks(e,t))}function Zs(e,t=Us.current){return Ks(Js(e,t))}function Xs(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function Qs(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function Ys(e,t){let r=0;for(let n=0;n=r&&e<=r+i.h&&(e-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}const ec=Qs("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),tc="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),rc=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],nc=Xs("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),ic=Xs("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),oc=Xs("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?Ws(e):Ws(55296+((e-=65536)>>10&1023))+Ws(56320+(1023&e))})).join("")+'"'},formatBytes32String:function(e){const t=Js(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return To(Co([t,Bs]).slice(0,32))},nameprep:function(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=Zs(e);var r;r=t.map((e=>{if(tc.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=Ys(e,rc);if(t)return[e+t.s];let r=nc[e];if(r)return r;let n=ic[e];return n?[e+n[0]]:oc[e]||null}(e);return t||[e]})),t=r.reduce(((e,t)=>(t.forEach((t=>{e.push(t)})),e)),[]),t=Zs(Gs(t),Us.NFKC),t.forEach((e=>{if(Ys(e,ac))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),t.forEach((e=>{if(Ys(e,ec))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=Gs(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n},parseBytes32String:function(e){const t=Mo(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===t[r-1];)r--;return Vs(t.slice(0,r))},toUtf8Bytes:Js,toUtf8CodePoints:Zs,toUtf8String:Vs});class cc extends Is{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Js(t))}decode(e){return Vs(super.decode(e))}}class uc extends Ya{constructor(e,t){let r=!1;const n=[];e.forEach((e=>{e.dynamic&&(r=!0),n.push(e.type)}));super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))})),Object.freeze(e)}encode(e,t){return xs(e,this.coders,t)}decode(e){return e.coerce(this.name,ks(e,this.coders))}}const fc=new wo(ka),dc=new RegExp(/^bytes([0-9]*)$/),lc=new RegExp(/^(u?int)([0-9]*)$/);class hc{constructor(e){ga(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Es(e.name);case"bool":return new Cs(e.name);case"string":return new cc(e.name);case"bytes":return new Rs(e.name);case"array":return new Ms(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new uc((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new Os(e.name)}let t=e.type.match(lc);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&fc.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Fs(r/8,"int"===t[1],e.name)}if(t=e.type.match(dc),t){let r=parseInt(t[1]);return(0===r||r>32)&&fc.throwArgumentError("invalid bytes length","param",e),new Ns(r,e.name)}return fc.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new ts(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new es(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(Da.from(e))));return new uc(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&fc.throwError("types/values length mismatch",wo.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(Da.from(e)))),n=new uc(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(Da.from(e))));return new uc(n,"_").decode(this._getReader(Mo(t),r))}}const pc=new hc;function mc(e){return is(Js(e))}const gc="hash/5.7.0";function yc(e){e=atob(e);const t=[];for(let r=0;r0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function Ac(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let e=1;e>--c&1}const d=Math.pow(2,31),l=d>>>1,h=l>>1,p=d-1;let m=0;for(let e=0;e<31;e++)m=m<<1|f();let g=[],y=0,b=d;for(;;){let e=Math.floor(((m-y+1)*i-1)/b),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e>>1|f(),a=a<<1^l,s=(s^l)<<1|l|1;y=a,b=1+s-a}let v=n-4;return g.map((t=>{switch(t-v){case 3:return v+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return v+256+(e[s++]<<8|e[s++]);case 1:return v+e[s++];default:return t-1}}))}(e))}function _c(e){return 1&e?~e>>1:e>>1}function Ec(e,t){let r=Array(e);for(let n=0,i=-1;nt[e])):r}function xc(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;in[t].push(e)));return n}function kc(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return wc(xc(i.length,1+e,t).map(((e,t)=>{const o=e[0],a=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[o+t*r,a.map((e=>e+i))]}))})))}function Mc(e,t){return xc(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const Cc=Ac(yc("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Ic=new Set(Pc(Cc)),Rc=new Set(Pc(Cc)),Nc=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(kc(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(Mc(r,e))}return function(e){const t={};for(let r=0;re-t));return function r(){let n=[];for(;;){let i=Pc(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:a,save:1==i,check:2==i}}()}(Cc),Tc=45,jc=95;function Dc(e){return Zs(e)}function $c(e){return e.filter((e=>65039!=e))}function Bc(e){for(let t of e.split(".")){let e=Dc(t);try{for(let t=e.lastIndexOf(jc)-1;t>=0;t--)if(e[t]!==jc)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===Tc&&e[3]===Tc)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function Fc(e){return Bc(function(e,t){let r=Dc(e).reverse(),n=[];for(;r.length;){let e=zc(r);if(e){n.push(...t(e));continue}let i=r.pop();if(Ic.has(i)){n.push(i);continue}if(Rc.has(i))continue;let o=Nc[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return Bc(function(e){return e.normalize("NFC")}(String.fromCodePoint(...n)))}(e,$c))}function zc(e,t){var r;let n,i,o=Oc,a=[],s=e.length;for(t&&(t.length=0);s;){let c=e[--s];if(o=null===(r=o.branches.find((e=>e.set.has(c))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=c;else if(o.check&&c===i)break;a.push(c),o.fe0f&&(a.push(65039),s>0&&65039==e[s-1]&&s--),o.valid&&(n=a.slice(),2==o.valid&&n.splice(1,1),t&&t.push(...e.slice(s).reverse()),e.length=s)}return n}const Uc=new wo(gc),Lc=new Uint8Array(32);function qc(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function Hc(e){const t=Js(Fc(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e=t.length)throw new Error("invalid ENS name; empty component");return r.push(qc(t.slice(n))),r}function Kc(e){"string"!=typeof e&&Uc.throwArgumentError("invalid ENS name; not a string","name",e);let t=Lc;const r=Hc(e);for(;r.length;)t=is(Co([t,is(r.pop())]));return To(t)}function Jc(e){return To(Co(Hc(e).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}Lc.fill(0);const Wc="Ethereum Signed Message:\n";function Gc(e){return"string"==typeof e&&(e=Js(e)),is(Co([Js(Wc),Js(String(e.length)),e]))}var Vc=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const Zc=new wo(gc),Xc=new Uint8Array(32);Xc.fill(0);const Qc=Zo.from(-1),Yc=Zo.from(0),eu=Zo.from(1),tu=Zo.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const ru=zo(eu.toHexString(),32),nu=zo(Yc.toHexString(),32),iu={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ou=["name","version","chainId","verifyingContract","salt"];function au(e){return function(t){return"string"!=typeof t&&Zc.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const su={name:au("name"),version:au("version"),chainId:function(e){try{return Zo.from(e).toString()}catch(e){}return Zc.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return ws(e).toLowerCase()}catch(e){}return Zc.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=Mo(e);if(32!==t.length)throw new Error("bad length");return To(t)}catch(e){}return Zc.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function cu(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&Zc.throwArgumentError("invalid numeric width","type",e);const i=tu.mask(r?n-1:n),o=r?i.add(eu).mul(Qc):Yc;return function(t){const r=Zo.from(t);return(r.lt(o)||r.gt(i))&&Zc.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),zo(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&Zc.throwArgumentError("invalid bytes width","type",e),function(t){return Mo(t).length!==r&&Zc.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=Mo(e),r=t.length%32;return r?$o([t,Xc.slice(r)]):To(t)}(t)}}}switch(e){case"address":return function(e){return zo(ws(e),32)};case"bool":return function(e){return e?ru:nu};case"bytes":return function(e){return is(e)};case"string":return function(e){return mc(e)}}return null}function uu(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class fu{constructor(e){ga(this,"types",Object.freeze(Sa(e))),ga(this,"_encoderCache",{}),ga(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const n in e){const i={};e[n].forEach((o=>{i[o.name]&&Zc.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",e),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===n&&Zc.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e);cu(a)||(r[a]||Zc.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",e),r[a].push(n),t[n][a]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?Zc.throwArgumentError("missing primary type","types",e):i.length>1&&Zc.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),ga(this,"primaryType",i[0]),function i(o,a){a[o]&&Zc.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),a[o]=!0,Object.keys(t[o]).forEach((e=>{r[e]&&(i(e,a),Object.keys(a).forEach((t=>{n[t][e]=!0})))})),delete a[o]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=uu(t,e[t])+r.map((t=>uu(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=cu(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&Zc.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(is)),is($o(i))}}const r=this.types[e];if(r){const t=mc(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?is(n):n}));return n.unshift(t),$o(n)}}return Zc.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Zc.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return is(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(cu(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&Zc.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const i=this.types[e];return i?i.reduce(((e,{name:n,type:i})=>(e[n]=this._visit(i,t[n],r),e)),{}):Zc.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new fu(e)}static getPrimaryType(e){return fu.from(e).primaryType}static hashStruct(e,t,r){return fu.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=iu[r];n||Zc.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>ou.indexOf(e.name)-ou.indexOf(t.name))),fu.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return $o(["0x1901",fu.hashDomain(e),fu.from(t).hash(r)])}static hash(e,t,r){return is(fu.encode(e,t,r))}static resolveNames(e,t,r,n){return Vc(this,void 0,void 0,(function*(){e=wa(e);const i={};e.verifyingContract&&!No(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=fu.from(t);o.visit(r,((e,t)=>("address"!==e||No(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){fu.hashDomain(e);const n={},i=[];ou.forEach((t=>{const r=e[t];null!=r&&(n[t]=su[t](r),i.push({name:t,type:iu[t]}))}));const o=fu.from(t),a=wa(t);return a.EIP712Domain?Zc.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=i,o.encode(r),{types:a,domain:n,primaryType:o.primaryType,message:o.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return To(Mo(t));if(e.match(/^u?int/))return Zo.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&Zc.throwArgumentError("invalid string","value",t),t}return Zc.throwArgumentError("unsupported type","type",e)}))}}}var du=Object.freeze({__proto__:null,_TypedDataEncoder:fu,dnsEncode:Jc,ensNormalize:function(e){return Hc(e).map((e=>Vs(e))).join(".")},hashMessage:Gc,id:mc,isValidName:function(e){try{return 0!==Hc(e).length}catch(e){}return!1},messagePrefix:Wc,namehash:Kc});const lu=new wo(ka);class hu extends Pa{}class pu extends Pa{}class mu extends Pa{}class gu extends Pa{static isIndexed(e){return!(!e||!e._isIndexed)}}const yu={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function bu(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class vu{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,ga(this,"fragments",t.map((e=>Ba.from(e))).filter((e=>null!=e))),ga(this,"_abiCoder",ya(new.target,"getAbiCoder")()),ga(this,"functions",{}),ga(this,"errors",{}),ga(this,"events",{}),ga(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void lu.warn("duplicate definition - constructor"):void ga(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();t[r]?lu.warn("duplicate definition - "+r):t[r]=e})),this.deploy||ga(this,"deploy",qa.from({payable:!1,type:"constructor"})),ga(this,"_isInterface",!0)}format(e){e||(e=Ta.full),e===Ta.sighash&&lu.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===Ta.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return pc}static getAddress(e){return ws(e)}static getSighash(e){return Do(mc(e.format()),0,4)}static getEventTopic(e){return mc(e.format())}getFunction(e){if(No(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];lu.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===r.length?lu.throwArgumentError("no matching function","name",t):r.length>1&&lu.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[Ha.fromString(e).format()];return t||lu.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(No(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];lu.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===r.length?lu.throwArgumentError("no matching event","name",t):r.length>1&&lu.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[Fa.fromString(e).format()];return t||lu.throwArgumentError("no matching event","signature",e),t}getError(e){if(No(e)){const t=ya(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}lu.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===r.length?lu.throwArgumentError("no matching error","name",t):r.length>1&&lu.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[Ha.fromString(e).format()];return t||lu.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return ya(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),ya(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const r=Mo(t);return To(r.slice(0,4))!==this.getSighash(e)&&lu.throwArgumentError(`data signature does not match error ${e.name}.`,"data",To(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),To(Co([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=Mo(t);return To(r.slice(0,4))!==this.getSighash(e)&&lu.throwArgumentError(`data signature does not match function ${e.name}.`,"data",To(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),To(Co([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=Mo(t),n=null,i="",o=null,a=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=To(r.slice(0,4)),t=yu[e];if(t)o=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,s=t.signature,t.reason&&(n=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const t=this.getError(e);o=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,s=t.format()}catch(e){}break}}return lu.throwError("call revert exception"+i,wo.errors.CALL_EXCEPTION,{method:e.format(),data:To(t),errorArgs:o,errorName:a,errorSignature:s,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),To(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&lu.throwError("too many arguments for "+e.format(),wo.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?mc(t):"bytes"===e.type?is(To(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=Zo.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),zo(To(t),32));for(t.forEach(((t,i)=>{let o=e.inputs[i];o.indexed?null==t?r.push(null):"array"===o.baseType||"tuple"===o.baseType?lu.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?r.push(t.map((e=>n(o,e)))):r.push(n(o,t)):null!=t&&lu.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&lu.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const a=t[o];if(e.indexed)if("string"===e.type)r.push(mc(a));else if("bytes"===e.type)r.push(is(a));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[a]))}else n.push(e),i.push(a)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);No(r[0],32)&&r[0].toLowerCase()===t||lu.throwError("fragment/topic mismatch",wo.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(Da.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let a=null!=r?this._abiCoder.decode(n,Co(r)):null,s=this._abiCoder.decode(i,t,!0),c=[],u=0,f=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==a)c[t]=new gu({_isIndexed:!0,hash:null});else if(o[t])c[t]=new gu({_isIndexed:!0,hash:a[f++]});else try{c[t]=a[f++]}catch(e){c[t]=e}else try{c[t]=s[u++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){const r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:()=>{throw bu(`property ${JSON.stringify(e.name)}`,r)}}):c[e.name]=r}}));for(let e=0;e{throw bu(`index ${e}`,t)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new pu({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Zo.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new hu({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=To(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new mu({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var wu=Object.freeze({__proto__:null,AbiCoder:hc,ConstructorFragment:qa,ErrorFragment:Ja,EventFragment:Fa,FormatTypes:Ta,Fragment:Ba,FunctionFragment:Ha,Indexed:gu,Interface:vu,LogDescription:hu,ParamType:Da,TransactionDescription:pu,checkResultErrors:Qa,defaultAbiCoder:pc});var Au=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const _u=new wo("abstract-provider/5.7.0");class Eu extends Pa{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class Su{constructor(){_u.checkAbstract(new.target,Su),ga(this,"_isProvider",!0)}getFeeData(){return Au(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield ba({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=Zo.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}var Pu=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const xu=new wo("abstract-signer/5.7.0"),ku=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Mu=[wo.errors.INSUFFICIENT_FUNDS,wo.errors.NONCE_EXPIRED,wo.errors.REPLACEMENT_UNDERPRICED];class Cu{constructor(){xu.checkAbstract(new.target,Cu),ga(this,"_isSigner",!0)}getBalance(e){return Pu(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return Pu(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return Pu(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield ba(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return Pu(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield ba(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return Pu(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return Pu(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Pu(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Pu(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return Pu(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===ku.indexOf(t)&&xu.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=wa(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&xu.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return Pu(this,void 0,void 0,(function*(){const t=yield ba(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>Pu(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&xu.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||xu.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):xu.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(r&&xu.throwError("network does not support EIP-1559",wo.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):xu.throwError("failed to get consistent fee data",wo.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(Mu.indexOf(e.code)>=0)throw e;return xu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",wo.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&xu.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield ba(t)}))}_checkProvider(e){this.provider||xu.throwError("missing provider",wo.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class Iu extends Cu{constructor(e,t){super(),ga(this,"address",e),ga(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{xu.throwError(e,wo.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Iu(this.address,e)}}function Ru(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},e(r,r.exports),r.exports}var Nu=Ou;function Ou(e,t){if(!e)throw new Error(t||"Assertion failed")}Ou.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Tu=Ru((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),ju=Ru((function(e,t){var r=t;r.assert=Nu,r.toArray=Tu.toArray,r.zero2=Tu.zero2,r.toHex=Tu.toHex,r.encode=Tu.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=0==(1&c)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(a),s=0==(1&u)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new uo(e,"hex","le")}})),Du=ju.getNAF,$u=ju.getJSF,Bu=ju.assert;function Fu(e,t){this.type=e,this.p=new uo(t.p,16),this.red=t.prime?uo.red(t.prime):uo.mont(this.p),this.zero=new uo(0).toRed(this.red),this.one=new uo(1).toRed(this.red),this.two=new uo(2).toRed(this.red),this.n=t.n&&new uo(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zu=Fu;function Uu(e,t){this.curve=e,this.type=t,this.precomputed=null}Fu.prototype.point=function(){throw new Error("Not implemented")},Fu.prototype.validate=function(){throw new Error("Not implemented")},Fu.prototype._fixedNafMul=function(e,t){Bu(e.precomputed);var r=e._getDoubles(),n=Du(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];Bu(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},Fu.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,f=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=$u(r[h],r[p]);for(d=Math.max(y[0].length,d),f[h]=new Array(d),f[p]=new Array(d),a=0;a=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},Uu.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},Hu.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},Hu.prototype.pointFromX=function(e,t){(e=new uo(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},Hu.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Hu.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Ju.prototype.isInfinity=function(){return this.inf},Ju.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ju.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Ju.prototype.getX=function(){return this.x.fromRed()},Ju.prototype.getY=function(){return this.y.fromRed()},Ju.prototype.mul=function(e){return e=new uo(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Ju.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Ju.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Ju.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Ju.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Ju.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Lu(Wu,zu.BasePoint),Hu.prototype.jpoint=function(e,t,r){return new Wu(this,e,t,r)},Wu.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Wu.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Wu.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),d=n.redMul(u),l=c.redSqr().redIAdd(f).redISub(d).redISub(d),h=c.redMul(d.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,h,p)},Wu.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),f=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(f).redISub(f),l=s.redMul(f.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,l,h)},Wu.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Wu.prototype.inspect=function(){return this.isInfinity()?"":""},Wu.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Gu=Ru((function(e,t){var r=t;r.base=zu,r.short=Ku,r.mont=null,r.edwards=null})),Vu=Ru((function(e,t){var r,n=t,i=ju.assert;function o(e){"short"===e.type?this.curve=new Gu.short(e):"edwards"===e.type?this.curve=new Gu.edwards(e):this.curve=new Gu.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ir.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ir.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ir.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ir.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ir.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ir.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ir.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ir.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Zu(e){if(!(this instanceof Zu))return new Zu(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Tu.toArray(e.entropy,e.entropyEnc||"hex"),r=Tu.toArray(e.nonce,e.nonceEnc||"hex"),n=Tu.toArray(e.pers,e.persEnc||"hex");Nu(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Xu=Zu;Zu.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Zu.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=Tu.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var tf=ju.assert;function rf(e,t){if(e instanceof rf)return e;this._importDER(e,t)||(tf(e.r&&e.s,"Signature without r or s"),this.r=new uo(e.r,16),this.s=new uo(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var nf=rf;function of(){this.place=0}function af(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function sf(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}rf.prototype._importDER=function(e,t){e=ju.toArray(e,t);var r=new of;if(48!==e[r.place++])return!1;var n=af(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=af(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=af(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new uo(o),this.s=new uo(s),this.recoveryParam=null,!0},rf.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=sf(t),r=sf(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];cf(n,t.length),(n=n.concat(t)).push(2),cf(n,r.length);var i=n.concat(r),o=[48];return cf(o,i.length),o=o.concat(i),ju.encode(o,e)};var uf=function(){throw new Error("unsupported")},ff=ju.assert;function df(e){if(!(this instanceof df))return new df(e);"string"==typeof e&&(ff(Object.prototype.hasOwnProperty.call(Vu,e),"Unknown curve "+e),e=Vu[e]),e instanceof Vu.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var lf=df;df.prototype.keyPair=function(e){return new ef(this,e)},df.prototype.keyFromPrivate=function(e,t){return ef.fromPrivate(this,e,t)},df.prototype.keyFromPublic=function(e,t){return ef.fromPublic(this,e,t)},df.prototype.genKeyPair=function(e){e||(e={});for(var t=new Xu({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||uf(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new uo(2));;){var i=new uo(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},df.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},df.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new uo(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new Xu({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new uo(1)),u=0;;u++){var f=n.k?n.k(u):new uo(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var l=d.getX(),h=l.umod(this.n);if(0!==h.cmpn(0)){var p=f.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==l.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new nf({r:h,s:p,recoveryParam:m})}}}}}},df.prototype.verify=function(e,t,r,n){e=this._truncateToN(new uo(e,16)),r=this.keyFromPublic(r,n);var i=(t=new nf(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},df.prototype.recoverPubKey=function(e,t,r,n){ff((3&r)===r,"The recovery param is more than two bits"),t=new nf(t,n);var i=this.n,o=new uo(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var f=t.r.invm(i),d=i.sub(o).mul(f).umod(i),l=s.mul(f).umod(i);return this.g.mulAdd(d,a,l)},df.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new nf(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var hf=Ru((function(e,t){var r=t;r.version="6.5.4",r.utils=ju,r.rand=function(){throw new Error("unsupported")},r.curve=Gu,r.curves=Vu,r.ec=lf,r.eddsa=null})),pf=hf.ec;const mf=new wo("signing-key/5.7.0");let gf=null;function yf(){return gf||(gf=new pf("secp256k1")),gf}class bf{constructor(e){ga(this,"curve","secp256k1"),ga(this,"privateKey",To(e)),32!==jo(this.privateKey)&&mf.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=yf().keyFromPrivate(Mo(this.privateKey));ga(this,"publicKey","0x"+t.getPublic(!1,"hex")),ga(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),ga(this,"_isSigningKey",!0)}_addPoint(e){const t=yf().keyFromPublic(Mo(this.publicKey)),r=yf().keyFromPublic(Mo(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=yf().keyFromPrivate(Mo(this.privateKey)),r=Mo(e);32!==r.length&&mf.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return Uo({recoveryParam:n.recoveryParam,r:zo("0x"+n.r.toString(16),32),s:zo("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=yf().keyFromPrivate(Mo(this.privateKey)),r=yf().keyFromPublic(Mo(wf(e)));return zo("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function vf(e,t){const r=Uo(t),n={r:Mo(r.r),s:Mo(r.s)};return"0x"+yf().recoverPubKey(Mo(e),n,r.recoveryParam).encode("hex",!1)}function wf(e,t){const r=Mo(e);if(32===r.length){const e=new bf(r);return t?"0x"+yf().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?To(r):"0x"+yf().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+yf().keyFromPublic(r).getPublic(!0,"hex"):To(r):mf.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Af=Object.freeze({__proto__:null,SigningKey:bf,computePublicKey:wf,recoverPublicKey:vf});const _f=new wo("transactions/5.7.0");var Ef;function Sf(e){return"0x"===e?null:ws(e)}function Pf(e){return"0x"===e?js:Zo.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ef||(Ef={}));const xf=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],kf={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function Mf(e){return ws(Do(is(Do(wf(e),1)),12))}function Cf(e,t){return Mf(vf(Mo(e),t))}function If(e,t){const r=Io(Zo.from(e).toHexString());return r.length>32&&_f.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function Rf(e,t){return{address:ws(e),storageKeys:(t||[]).map(((t,r)=>(32!==jo(t)&&_f.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}function Nf(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&_f.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),Rf(e[0],e[1])):Rf(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return Rf(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function Of(e){return Nf(e).map((e=>[e.address,e.storageKeys]))}function Tf(e,t){if(null!=e.gasPrice){const t=Zo.from(e.gasPrice),r=Zo.from(e.maxFeePerGas||0);t.eq(r)||_f.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[If(e.chainId||0,"chainId"),If(e.nonce||0,"nonce"),If(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),If(e.maxFeePerGas||0,"maxFeePerGas"),If(e.gasLimit||0,"gasLimit"),null!=e.to?ws(e.to):"0x",If(e.value||0,"value"),e.data||"0x",Of(e.accessList||[])];if(t){const e=Uo(t);r.push(If(e.recoveryParam,"recoveryParam")),r.push(Io(e.r)),r.push(Io(e.s))}return $o(["0x02",fs(r)])}function jf(e,t){const r=[If(e.chainId||0,"chainId"),If(e.nonce||0,"nonce"),If(e.gasPrice||0,"gasPrice"),If(e.gasLimit||0,"gasLimit"),null!=e.to?ws(e.to):"0x",If(e.value||0,"value"),e.data||"0x",Of(e.accessList||[])];if(t){const e=Uo(t);r.push(If(e.recoveryParam,"recoveryParam")),r.push(Io(e.r)),r.push(Io(e.s))}return $o(["0x01",fs(r)])}function Df(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&_f.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){va(e,kf);const r=[];xf.forEach((function(t){let n=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),n=Mo(To(n,i)),t.length&&n.length!==t.length&&n.length>0&&_f.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=Io(n),n.length>t.maxLength&&_f.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n)),r.push(To(n))}));let n=0;if(null!=e.chainId?(n=e.chainId,"number"!=typeof n&&_f.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!Po(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push(To(n)),r.push("0x"),r.push("0x")),!t)return fs(r);const i=Uo(t);let o=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),o+=2*n+8,i.v>28&&i.v!==o&&_f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==o&&_f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(To(o)),r.push(Io(Mo(i.r))),r.push(Io(Mo(i.s))),fs(r)}(e,t);switch(e.type){case 1:return jf(e,t);case 2:return Tf(e,t)}return _f.throwError(`unsupported transaction type: ${e.type}`,wo.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function $f(e,t,r){try{const r=Pf(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){_f.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=zo(t[1],32),e.s=zo(t[2],32);try{const t=is(r(e));e.from=Cf(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function Bf(e){const t=Mo(e);if(t[0]>127)return function(e){const t=hs(e);9!==t.length&&6!==t.length&&_f.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:Pf(t[0]).toNumber(),gasPrice:Pf(t[1]),gasLimit:Pf(t[2]),to:Sf(t[3]),value:Pf(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=Zo.from(t[6]).toNumber()}catch(e){return r}if(r.r=zo(t[7],32),r.s=zo(t[8],32),Zo.from(r.r).isZero()&&Zo.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=t.slice(0,6);0!==r.chainId&&(i.push(To(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=is(fs(i));try{r.from=Cf(o,{r:To(r.r),s:To(r.s),recoveryParam:n})}catch(e){}r.hash=is(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=hs(e.slice(1));8!==t.length&&11!==t.length&&_f.throwArgumentError("invalid component count for transaction type: 1","payload",To(e));const r={type:1,chainId:Pf(t[0]).toNumber(),nonce:Pf(t[1]).toNumber(),gasPrice:Pf(t[2]),gasLimit:Pf(t[3]),to:Sf(t[4]),value:Pf(t[5]),data:t[6],accessList:Nf(t[7])};return 8===t.length||(r.hash=is(e),$f(r,t.slice(8),jf)),r}(t);case 2:return function(e){const t=hs(e.slice(1));9!==t.length&&12!==t.length&&_f.throwArgumentError("invalid component count for transaction type: 2","payload",To(e));const r=Pf(t[2]),n=Pf(t[3]),i={type:2,chainId:Pf(t[0]).toNumber(),nonce:Pf(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Pf(t[4]),to:Sf(t[5]),value:Pf(t[6]),data:t[7],accessList:Nf(t[8])};return 9===t.length||(i.hash=is(e),$f(i,t.slice(9),Tf)),i}(t)}return _f.throwError(`unsupported transaction type: ${t[0]}`,wo.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}var Ff=Object.freeze({__proto__:null,get TransactionTypes(){return Ef},accessListify:Nf,computeAddress:Mf,parse:Bf,recoverAddress:Cf,serialize:Df});var zf=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const Uf=new wo("contracts/5.7.0");function Lf(e,t){return zf(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&Uf.throwArgumentError("invalid address or ENS name","name",r);try{return ws(r)}catch(e){}e||Uf.throwError("a provider or signer is needed to resolve ENS names",wo.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&Uf.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function qf(e,t,r){return zf(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>qf(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield Lf(e,t):"tuple"===r.type?yield qf(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>qf(e,t,r.arrayChildren)))):Promise.reject(Uf.makeError("invalid value for array",wo.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function Hf(e,t,r){return zf(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=wa(r.pop())),Uf.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=ba({override:Lf(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>zf(this,void 0,void 0,(function*(){return ws(e.signer)!==e.override&&Uf.throwError("Contract with a Signer cannot override from",wo.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=Lf(e.provider,n.from));const i=yield ba({args:qf(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:ba(n)||{}}),o=e.interface.encodeFunctionData(t,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=Zo.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=Zo.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=Zo.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=Zo.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=Zo.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=Nf(s.accessList)),null==a.gasLimit&&null!=t.gas){let e=21e3;const r=Mo(o);for(let t=0;tnull!=n[e]));return c.length&&Uf.throwError(`cannot override ${c.map((e=>JSON.stringify(e))).join(",")}`,wo.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:c}),a}))}function Kf(e,t,r){const n=e.signer||e.provider;return function(...i){return zf(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=wa(i.pop());null!=e.blockTag&&(o=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(o));const a=yield Hf(e,t,i),s=yield n.call(a,o);try{let n=e.interface.decodeFunctionResult(t,s);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===wo.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=a),t}}))}}function Jf(e,t){return function(...r){return zf(this,void 0,void 0,(function*(){e.signer||Uf.throwError("sending a transaction requires a signer",wo.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield Hf(e,t,r),i=yield e.signer.sendTransaction(n);return function(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=Sa(r),i=null;try{i=e.interface.parseLog(r)}catch(e){}return i&&(n.args=i.args,n.decode=(t,r)=>e.interface.decodeEventLog(i.eventFragment,t,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n})),t)))}(e,i),i}))}}function Wf(e,t,r){return t.constant?Kf(e,t,r):Jf(e,t)}function Gf(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class Vf{constructor(e,t){ga(this,"tag",e),ga(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((r=>!(!t&&r.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const r=e.slice();return setTimeout((()=>{t.listener.apply(this,r)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class Zf extends Vf{constructor(){super("error",null)}}class Xf extends Vf{constructor(e,t,r,n){const i={address:e};let o=t.getEventTopic(r);n?(o!==n[0]&&Uf.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(Gf(i),i),ga(this,"address",e),ga(this,"interface",t),ga(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=Qa(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class Qf extends Vf{constructor(e,t){super("*",{address:e}),ga(this,"address",e),ga(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class Yf{constructor(e,t,r){ga(this,"interface",ya(new.target,"getInterface")(t)),null==r?(ga(this,"provider",null),ga(this,"signer",null)):Cu.isSigner(r)?(ga(this,"provider",r.provider||null),ga(this,"signer",r)):Su.isProvider(r)?(ga(this,"provider",r),ga(this,"signer",null)):Uf.throwArgumentError("invalid signer or provider","signerOrProvider",r),ga(this,"callStatic",{}),ga(this,"estimateGas",{}),ga(this,"functions",{}),ga(this,"populateTransaction",{}),ga(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];ga(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)}))),e[r.name]||(e[r.name]=[]),e[r.name].push(t)})),Object.keys(e).forEach((t=>{const r=e[t];1===r.length?ga(this.filters,t,this.filters[r[0]]):Uf.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if(ga(this,"_runningEvents",{}),ga(this,"_wrappedEmits",{}),null==e&&Uf.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ga(this,"address",e),this.provider)ga(this,"resolvedAddress",Lf(this.provider,e));else try{ga(this,"resolvedAddress",Promise.resolve(ws(e)))}catch(e){Uf.throwError("provider is required to use ENS name as contract address",wo.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])Uf.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}null==this[e]&&ga(this,e,Wf(this,t,!0)),null==this.functions[e]&&ga(this.functions,e,Wf(this,t,!1)),null==this.callStatic[e]&&ga(this.callStatic,e,Kf(this,t,!0)),null==this.populateTransaction[e]&&ga(this.populateTransaction,e,function(e,t){return function(...r){return Hf(e,t,r)}}(this,t)),null==this.estimateGas[e]&&ga(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return zf(this,void 0,void 0,(function*(){r||Uf.throwError("estimate require a provider or signer",wo.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Hf(e,t,n);return yield r.estimateGas(i)}))}}(this,t))}})),Object.keys(n).forEach((e=>{const t=n[e];if(t.length>1)return;e=e.substring(1);const r=t[0];try{null==this[e]&&ga(this,e,this[r])}catch(e){}null==this.functions[e]&&ga(this.functions,e,this.functions[r]),null==this.callStatic[e]&&ga(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&ga(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&ga(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return As(e)}static getInterface(e){return vu.isInterface(e)?e:new vu(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&Uf.throwError("contract not deployed",wo.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||Uf.throwError("sending a transactions require a signer",wo.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=wa(e||{});return["from","to"].forEach((function(e){null!=t[e]&&Uf.throwError("cannot override "+e,wo.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new Iu(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ga(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return gu.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new Zf);if("event"===e)return this._normalizeRunningEvent(new Vf("event",null));if("*"===e)return this._normalizeRunningEvent(new Qf(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Xf(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const r=this.interface.getEvent(t);return this._normalizeRunningEvent(new Xf(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Vf(Gf(t),t))}return this._normalizeRunningEvent(new Qf(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const n=Sa(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||Uf.throwError("events require a provider or a signer with a provider",wo.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{const t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){const n=this._getRunningEvent(e),i=wa(n.filter);return"string"==typeof t&&No(t,32)?(null!=r&&Uf.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(n,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class ed extends Yf{}class td{constructor(e){ga(this,"alphabet",e),ga(this,"base",e.length),ga(this,"_alphabetMap",{}),ga(this,"_leader",e.charAt(0));for(let t=0;t0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e=0;--e)n+=this.alphabet[r[e]];return n}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r>24&255,c[t.length+1]=d>>16&255,c[t.length+2]=d>>8&255,c[t.length+3]=255&d;let l=Mo(ud(i,e,c));o||(o=l.length,f=new Uint8Array(o),a=Math.ceil(n/o),u=n-(a-1)*o),f.set(l);for(let t=1;t=256)throw new Error("Depth too large!");return Sd(Co([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",To(this.depth),this.parentFingerprint,zo(To(this.index),4),this.chainCode,null!=this.privateKey?Co(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new Md(xd,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let t=this.path;t&&(t+="/"+(2147483647&e));const r=new Uint8Array(37);if(e&Ad){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(Mo(this.privateKey),1),t&&(t+="'")}else r.set(Mo(this.publicKey));for(let t=24;t>=0;t-=8)r[33+(t>>3)]=e>>24-t&255;const n=Mo(ud(id.sha512,this.chainCode,r)),i=n.slice(0,32),o=n.slice(32);let a=null,s=null;if(this.privateKey)a=Ed(Zo.from(i).add(this.privateKey).mod(vd));else{s=new bf(To(i))._addPoint(this.publicKey)}let c=t;const u=this.mnemonic;return u&&(c=Object.freeze({phrase:u.phrase,path:t,locale:u.locale||"en"})),new Md(xd,a,s,this.fingerprint,Ed(o),e,this.depth+1,c)}derivePath(e){const t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();let r=this;for(let e=0;e=Ad)throw new Error("invalid path index - "+n);r=r._derive(Ad+e)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const e=parseInt(n);if(e>=Ad)throw new Error("invalid path index - "+n);r=r._derive(e)}}}return r}static _fromSeed(e,t){const r=Mo(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=Mo(ud(id.sha512,wd,r));return new Md(xd,Ed(n.slice(0,32)),null,"0x00000000",Ed(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=Rd(Id(e,r=Pd(r)),r),Md._fromSeed(Cd(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return Md._fromSeed(e,null)}static fromExtendedKey(e){const t=nd.decode(e);82===t.length&&Sd(t.slice(0,78))===e||bd.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],n=To(t.slice(5,9)),i=parseInt(To(t.slice(9,13)).substring(2),16),o=To(t.slice(13,45)),a=t.slice(45,78);switch(To(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new Md(xd,null,To(a),n,o,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==a[0])break;return new Md(xd,To(a.slice(1)),null,n,o,i,r,null)}return bd.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function Cd(e,t){t||(t="");const r=Js("mnemonic"+t,Us.NFKD);return dd(Js(e,Us.NFKD),r,2048,64,"sha512")}function Id(e,t){t=Pd(t),bd.checkNormalize();const r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=Mo(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let e=0;e>3]|=1<<7-i%8),i++}const o=32*r.length/3,a=_d(r.length/3);if((Mo(cd(n.slice(0,o/8)))[0]&a)!==(n[n.length-1]&a))throw new Error("invalid checksum");return To(n.slice(0,o/8))}function Rd(e,t){if(t=Pd(t),(e=Mo(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let t=0;t8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&(1<<8-n)-1),n+=3);const i=e.length/4,o=Mo(cd(e))[0]&_d(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,t.join(r.map((e=>t.getWord(e))))}var Nd=Object.freeze({__proto__:null,HDNode:Md,defaultPath:kd,entropyToMnemonic:Rd,getAccountPath:function(e){return("number"!=typeof e||e<0||e>=Ad||e%1)&&bd.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`},isValidMnemonic:function(e,t){try{return Id(e,t),!0}catch(e){}return!1},mnemonicToEntropy:Id,mnemonicToSeed:Cd});const Od=new wo("random/5.7.0");const Td=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();let jd=Td.crypto||Td.msCrypto;function Dd(e){(e<=0||e>1024||e%1||e!=e)&&Od.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return jd.getRandomValues(t),Mo(t)}jd&&jd.getRandomValues||(Od.warn("WARNING: Missing strong random number source"),jd={getRandomValues:function(e){return Od.throwError("no secure random source avaialble",wo.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var $d=Object.freeze({__proto__:null,randomBytes:Dd,shuffled:function(e){for(let t=(e=e.slice()).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}}),Bd={exports:{}};!function(e,t){!function(t){function r(e){return parseInt(e)===e}function n(e){if(!r(e.length))return!1;for(var t=0;t255)return!1;return!0}function i(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function o(e){return new Uint8Array(e)}function a(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var s,c={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},u=(s="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+s[15&n])}return t.join("")}}),f={16:10,24:12,32:14},d=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],l=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],m=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],y=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],b=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],v=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],w=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],A=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],E=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],S=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],P=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function x(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,s=0,c=i;c>16&255]<<24^l[a>>8&255]<<16^l[255&a]<<8^l[a>>24&255]^d[s]<<24,s+=1,8!=i)for(t=1;t>8&255]<<8^l[a>>16&255]<<16^l[a>>24&255]<<24;for(t=i/2+1;t>2,h=c%4,this._Ke[u][h]=o[t],this._Kd[e-u][h]=o[t++],c++}for(var u=1;u>24&255]^E[a>>16&255]^S[a>>8&255]^P[255&a]},k.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=x(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var a=1;a>24&255]^m[n[(i+1)%4]>>16&255]^g[n[(i+2)%4]>>8&255]^y[255&n[(i+3)%4]]^this._Ke[a][i];n=r.slice()}var s,c=o(16);for(i=0;i<4;i++)s=this._Ke[t][i],c[4*i]=255&(l[n[i]>>24&255]^s>>24),c[4*i+1]=255&(l[n[(i+1)%4]>>16&255]^s>>16),c[4*i+2]=255&(l[n[(i+2)%4]>>8&255]^s>>8),c[4*i+3]=255&(l[255&n[(i+3)%4]]^s);return c},k.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=x(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var a=1;a>24&255]^v[n[(i+3)%4]>>16&255]^w[n[(i+2)%4]>>8&255]^A[255&n[(i+1)%4]]^this._Kd[a][i];n=r.slice()}var s,c=o(16);for(i=0;i<4;i++)s=this._Kd[t][i],c[4*i]=255&(h[n[i]>>24&255]^s>>24),c[4*i+1]=255&(h[n[(i+3)%4]>>16&255]^s>>16),c[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^s>>8),c[4*i+3]=255&(h[255&n[(i+1)%4]]^s);return c};var M=function(e){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new k(e)};M.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},N.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},N.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var O=function(e,t){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof N||(t=new N(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new k(e)};O.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n=64;){let h,p,m,g,y,b=r,v=n,w=i,A=o,_=a,E=s,S=c,P=u;for(p=0;p<16;p++)m=d+4*p,f[p]=(255&e[m])<<24|(255&e[m+1])<<16|(255&e[m+2])<<8|255&e[m+3];for(p=16;p<64;p++)h=f[p-2],g=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,h=f[p-15],y=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,f[p]=(g+f[p-7]|0)+(y+f[p-16]|0)|0;for(p=0;p<64;p++)g=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&E^~_&S)|0)+(P+(t[p]+f[p]|0)|0)|0,y=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&v^b&w^v&w)|0,P=S,S=E,E=_,_=A+g|0,A=w,w=v,v=b,b=g+y|0;r=r+b|0,n=n+v|0,i=i+w|0,o=o+A|0,a=a+_|0,s=s+E|0,c=c+S|0,u=u+P|0,d+=64,l-=64}}d(e);let l,h=e.length%64,p=e.length/536870912|0,m=e.length<<3,g=h<56?56:120,y=e.slice(e.length-h,e.length);for(y.push(128),l=h+1;l>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(m>>>24&255),y.push(m>>>16&255),y.push(m>>>8&255),y.push(m>>>0&255),d(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);const i=64+t.length+4,o=new Array(i),a=new Array(64);let s,c=[];for(s=0;s<64;s++)o[s]=54;for(s=0;s=i-4;e--){if(o[e]++,o[e]<=255)return;o[e]=0}}for(;r>=32;)u(),c=c.concat(n(a.concat(n(o)))),r-=32;return r>0&&(u(),c=c.concat(n(a.concat(n(o))).slice(0,r))),c}function o(e,t,r,n,i){let o;for(u(e,16*(2*r-1),i,0,16),o=0;o<2*r;o++)c(e,16*o,i,16),s(i,n),u(i,0,e,t+16*o,16);for(o=0;o>>32-t}function s(e,t){u(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=a(t[0]+t[12],7),t[8]^=a(t[4]+t[0],9),t[12]^=a(t[8]+t[4],13),t[0]^=a(t[12]+t[8],18),t[9]^=a(t[5]+t[1],7),t[13]^=a(t[9]+t[5],9),t[1]^=a(t[13]+t[9],13),t[5]^=a(t[1]+t[13],18),t[14]^=a(t[10]+t[6],7),t[2]^=a(t[14]+t[10],9),t[6]^=a(t[2]+t[14],13),t[10]^=a(t[6]+t[2],18),t[3]^=a(t[15]+t[11],7),t[7]^=a(t[3]+t[15],9),t[11]^=a(t[7]+t[3],13),t[15]^=a(t[11]+t[7],18),t[1]^=a(t[0]+t[3],7),t[2]^=a(t[1]+t[0],9),t[3]^=a(t[2]+t[1],13),t[0]^=a(t[3]+t[2],18),t[6]^=a(t[5]+t[4],7),t[7]^=a(t[6]+t[5],9),t[4]^=a(t[7]+t[6],13),t[5]^=a(t[4]+t[7],18),t[11]^=a(t[10]+t[9],7),t[8]^=a(t[11]+t[10],9),t[9]^=a(t[8]+t[11],13),t[10]^=a(t[9]+t[8],18),t[12]^=a(t[15]+t[14],7),t[13]^=a(t[12]+t[15],9),t[14]^=a(t[13]+t[12],13),t[15]^=a(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function c(e,t,r,n){for(let i=0;i=256)return!1}return!0}function d(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function l(e,t,n,a,s,l,h){if(n=d(n,"N"),a=d(a,"r"),s=d(s,"p"),l=d(l,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/a)throw new Error("N too large");if(a>r/128/s)throw new Error("r too large");if(!f(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!f(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let p=i(e,t,128*s*a);const m=new Uint32Array(32*s*a);for(let e=0;eC&&(t=C);for(let e=0;eC&&(t=C);for(let e=0;e>0&255),p.push(m[e]>>8&255),p.push(m[e]>>16&255),p.push(m[e]>>24&255);const r=i(e,p,l);return h&&h(null,1,r),r}h&&I(R)};if(!h)for(;;){const e=R();if(null!=e)return e}R()}const h={scrypt:function(e,t,r,n,i,o,a){return new Promise((function(s,c){let u=0;a&&a(0),l(e,t,r,n,i,o,(function(e,t,r){if(e)c(e);else if(r)a&&1!==u&&a(1),s(new Uint8Array(r));else if(a&&t!==u)return u=t,a(t)}))}))},syncScrypt:function(e,t,r,n,i,o){return new Uint8Array(l(e,t,r,n,i,o))}};e.exports=h}()}(Xd);var Qd=f(Xd.exports),Yd=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const el=new wo(zd);function tl(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class rl extends Pa{isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function nl(e,t){const r=Ud(Hd(e,"crypto/ciphertext"));if(To(is(Co([t.slice(16,32),r]))).substring(2)!==Hd(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===Hd(e,"crypto/cipher")){const n=Ud(Hd(e,"crypto/cipherparams/iv")),i=new Fd.Counter(n);return Mo(new Fd.ModeOfOperation.ctr(t,i).decrypt(r))}return null}(e,t.slice(0,16),r);n||el.throwError("unsupported cipher",wo.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=t.slice(32,64),o=Mf(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),ws(t)!==o)throw new Error("address mismatch")}const a={_isKeystoreAccount:!0,address:o,privateKey:To(n)};if("0.1"===Hd(e,"x-ethers/version")){const t=Ud(Hd(e,"x-ethers/mnemonicCiphertext")),r=Ud(Hd(e,"x-ethers/mnemonicCounter")),n=new Fd.Counter(r),o=new Fd.ModeOfOperation.ctr(i,n),s=Hd(e,"x-ethers/path")||kd,c=Hd(e,"x-ethers/locale")||"en",u=Mo(o.decrypt(t));try{const e=Rd(u,c),t=Md.fromMnemonic(e,null,c).derivePath(s);if(t.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=t.mnemonic}catch(e){if(e.code!==wo.errors.INVALID_ARGUMENT||"wordlist"!==e.argument)throw e}}return new rl(a)}function il(e,t,r,n,i){return Mo(dd(e,t,r,n,i))}function ol(e,t,r,n,i){return Promise.resolve(il(e,t,r,n,i))}function al(e,t,r,n,i){const o=qd(t),a=Hd(e,"crypto/kdf");if(a&&"string"==typeof a){const t=function(e,t){return el.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===a.toLowerCase()){const r=Ud(Hd(e,"crypto/kdfparams/salt")),s=parseInt(Hd(e,"crypto/kdfparams/n")),c=parseInt(Hd(e,"crypto/kdfparams/r")),u=parseInt(Hd(e,"crypto/kdfparams/p"));s&&c&&u||t("kdf",a),0!=(s&s-1)&&t("N",s);const f=parseInt(Hd(e,"crypto/kdfparams/dklen"));return 32!==f&&t("dklen",f),n(o,r,s,c,u,64,i)}if("pbkdf2"===a.toLowerCase()){const n=Ud(Hd(e,"crypto/kdfparams/salt"));let i=null;const a=Hd(e,"crypto/kdfparams/prf");"hmac-sha256"===a?i="sha256":"hmac-sha512"===a?i="sha512":t("prf",a);const s=parseInt(Hd(e,"crypto/kdfparams/c")),c=parseInt(Hd(e,"crypto/kdfparams/dklen"));return 32!==c&&t("dklen",c),r(o,n,s,c,i)}}return el.throwArgumentError("unsupported key-derivation function","kdf",a)}function sl(e,t){const r=JSON.parse(e);return nl(r,al(r,t,il,Qd.syncScrypt))}function cl(e,t,r){return Yd(this,void 0,void 0,(function*(){const n=JSON.parse(e);return nl(n,yield al(n,t,ol,Qd.scrypt,r))}))}function ul(e,t,r,n){try{if(ws(e.address)!==Mf(e.privateKey))throw new Error("address/privateKey mismatch");if(tl(e)){const t=e.mnemonic;if(Md.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||kd).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(e){return Promise.reject(e)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const i=Mo(e.privateKey),o=qd(t);let a=null,s=null,c=null;if(tl(e)){const t=e.mnemonic;a=Mo(Id(t.phrase,t.locale||"en")),s=t.path||kd,c=t.locale||"en"}let u=r.client;u||(u="ethers.js");let f=null;f=r.salt?Mo(r.salt):Dd(32);let d=null;if(r.iv){if(d=Mo(r.iv),16!==d.length)throw new Error("invalid iv")}else d=Dd(16);let l=null;if(r.uuid){if(l=Mo(r.uuid),16!==l.length)throw new Error("invalid uuid")}else l=Dd(16);let h=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(h=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),Qd.scrypt(o,f,h,p,m,64,n).then((t=>{const r=(t=Mo(t)).slice(0,16),n=t.slice(16,32),o=t.slice(32,64),g=new Fd.Counter(d),y=Mo(new Fd.ModeOfOperation.ctr(r,g).encrypt(i)),b=is(Co([n,y])),v={address:e.address.substring(2).toLowerCase(),id:Kd(l),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:To(d).substring(2)},ciphertext:To(y).substring(2),kdf:"scrypt",kdfparams:{salt:To(f).substring(2),n:h,dklen:32,p:m,r:p},mac:b.substring(2)}};if(a){const e=Dd(16),t=new Fd.Counter(e),r=Mo(new Fd.ModeOfOperation.ctr(o,t).encrypt(a)),n=new Date,i=n.getUTCFullYear()+"-"+Ld(n.getUTCMonth()+1,2)+"-"+Ld(n.getUTCDate(),2)+"T"+Ld(n.getUTCHours(),2)+"-"+Ld(n.getUTCMinutes(),2)+"-"+Ld(n.getUTCSeconds(),2)+".0Z";v["x-ethers"]={client:u,gethFilename:"UTC--"+i+"--"+v.address,mnemonicCounter:To(e).substring(2),mnemonicCiphertext:To(r).substring(2),path:s,locale:c,version:"0.1"}}return JSON.stringify(v)}))}function fl(e,t,r){if(Vd(e)){r&&r(0);const n=Gd(e,t);return r&&r(1),Promise.resolve(n)}return Zd(e)?cl(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}function dl(e,t){if(Vd(e))return Gd(e,t);if(Zd(e))return sl(e,t);throw new Error("invalid JSON wallet")}var ll=Object.freeze({__proto__:null,decryptCrowdsale:Gd,decryptJsonWallet:fl,decryptJsonWalletSync:dl,decryptKeystore:cl,decryptKeystoreSync:sl,encryptKeystore:ul,getJsonWalletAddress:function(e){if(Vd(e))try{return ws(JSON.parse(e).ethaddr)}catch(e){return null}if(Zd(e))try{return ws(JSON.parse(e).address)}catch(e){return null}return null},isCrowdsaleWallet:Vd,isKeystoreWallet:Zd});var hl=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const pl=new wo("wallet/5.7.0");class ml extends Cu{constructor(e,t){if(super(),null!=(r=e)&&No(r.privateKey,32)&&null!=r.address){const t=new bf(e.privateKey);if(ga(this,"_signingKey",(()=>t)),ga(this,"address",Mf(this.publicKey)),this.address!==ws(e.address)&&pl.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;ga(this,"_mnemonic",(()=>({phrase:t.phrase,path:t.path||kd,locale:t.locale||"en"})));const r=this.mnemonic;Mf(Md.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path).privateKey)!==this.address&&pl.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ga(this,"_mnemonic",(()=>null))}else{if(bf.isSigningKey(e))"secp256k1"!==e.curve&&pl.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ga(this,"_signingKey",(()=>e));else{"string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new bf(e);ga(this,"_signingKey",(()=>t))}ga(this,"_mnemonic",(()=>null)),ga(this,"address",Mf(this.publicKey))}var r;t&&!Su.isProvider(t)&&pl.throwArgumentError("invalid provider","provider",t),ga(this,"provider",t||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new ml(this,e)}signTransaction(e){return ba(e).then((t=>{null!=t.from&&(ws(t.from)!==this.address&&pl.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest(is(Df(t)));return Df(t,r)}))}signMessage(e){return hl(this,void 0,void 0,(function*(){return Lo(this._signingKey().signDigest(Gc(e)))}))}_signTypedData(e,t,r){return hl(this,void 0,void 0,(function*(){const n=yield fu.resolveNames(e,t,r,(e=>(null==this.provider&&pl.throwError("cannot resolve ENS names without a provider",wo.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e))));return Lo(this._signingKey().signDigest(fu.hash(n.domain,t,n.value)))}))}encrypt(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t||(t={}),ul(this,e,t,r)}static createRandom(e){let t=Dd(16);e||(e={}),e.extraEntropy&&(t=Mo(Do(is(Co([t,e.extraEntropy])),0,16)));const r=Rd(t,e.locale);return ml.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return fl(e,t,r).then((e=>new ml(e)))}static fromEncryptedJsonSync(e,t){return new ml(dl(e,t))}static fromMnemonic(e,t,r){return t||(t=kd),new ml(Md.fromMnemonic(e,null,r).derivePath(t))}}var gl=Object.freeze({__proto__:null,Wallet:ml,verifyMessage:function(e,t){return Cf(Gc(e),t)},verifyTypedData:function(e,t,r,n){return Cf(fu.hash(e,t,r),n)}});const yl=new wo("networks/5.7.1");function bl(e){const t=function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(e,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new t.AnkrProvider(e,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}if(0===n.length)return null;if(t.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(n,i)}return n[0]};return t.renetwork=function(e){return bl(e)},t}function vl(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return vl(e,t)},r}const wl={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bl("homestead")},Al={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bl("ropsten")},_l={chainId:63,name:"classicMordor",_defaultProvider:vl("https://www.ethercluster.com/mordor","classicMordor")},El={unspecified:{chainId:0,name:"unspecified"},homestead:wl,mainnet:wl,morden:{chainId:2,name:"morden"},ropsten:Al,testnet:Al,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bl("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bl("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bl("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bl("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:vl("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:_l,classicTestnet:_l,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:vl("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bl("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bl("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};var Sl=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function Pl(e,t){return Sl(this,void 0,void 0,(function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach(((e,t)=>{o[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{o[e.toLowerCase()]=n.headers.get(e)})),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:Mo(new Uint8Array(i))}}))}var xl=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const kl=new wo("web/5.7.1");function Ml(e){return new Promise((t=>{setTimeout(t,e)}))}function Cl(e,t){if(null==e)return null;if("string"==typeof e)return e;if(Po(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Vs(e)}catch(e){}return To(e)}return e}function Il(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;kl.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,o="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;kl.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof e&&!!e.errorPassThrough,s={};let c=null;const u={method:"GET"};let f=!1,d=12e4;if("string"==typeof e)c=e;else if("object"==typeof e){if(null!=e&&null!=e.url||kl.throwArgumentError("missing URL","connection.url",e),c=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)s[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(f=!0);if(u.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==c.substring(0,6)&&!0!==e.allowInsecureAuthentication&&kl.throwError("basic authentication requires a secure https url",wo.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+bc(Js(t))}}null!=e.skipFetchSetup&&(u.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(u.fetchOptions=wa(e.fetchOptions))}const l=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=c?c.match(l):null;if(h)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?yc(h[3]):(p=h[3],Js(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){kl.throwError("processing response error",wo.errors.SERVER_ERROR,{body:Cl(h[1],h[2]),error:e,requestBody:null,requestMethod:"GET",url:c})}var p;t&&(u.method="POST",u.body=t,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(t.length)}));const m={};Object.keys(s).forEach((e=>{const t=s[e];m[t.key]=t.value})),u.headers=m;const g=function(){let e=null;return{promise:new Promise((function(t,r){d&&(e=setTimeout((()=>{null!=e&&(e=null,r(kl.makeError("timeout",wo.errors.TIMEOUT,{requestBody:Cl(u.body,m["content-type"]),requestMethod:u.method,timeout:d,url:c})))}),d))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return xl(this,void 0,void 0,(function*(){for(let e=0;e=300)&&(g.cancel(),kl.throwError("bad response",wo.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:Cl(s,t.headers?t.headers["content-type"]:null),requestBody:Cl(u.body,m["content-type"]),requestMethod:u.method,url:c})),r)try{const e=yield r(s,t);return g.cancel(),e}catch(r){if(r.throttleRetry&&e"content-type"===e.toLowerCase())).length||(r.headers=wa(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return Il(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(Vs(e))}catch(t){kl.throwError("invalid JSON",wo.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function Nl(e,t){return t||(t={}),null==(t=wa(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{a()&&n(new Error("timeout"))}),t.timeout));const s=t.retryLimit;let c=0;!function i(){return e().then((function(e){if(void 0!==e)a()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(c++,c>s)return void(a()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));et.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){a()&&n(e)}))}()}))}for(var Ol=Object.freeze({__proto__:null,_fetchData:Il,fetchJson:Rl,poll:Nl}),Tl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",jl={},Dl=0;Dl>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function Fl(e){for(var t=1,r=0;r126)return"Invalid prefix ("+e+")";t=Bl(t)^n>>5}for(t=Bl(t),r=0;rt)return"Exceeds length limit";var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)return"Mixed-case string "+e;var i=(e=r).lastIndexOf("1");if(-1===i)return"No separator character for "+e;if(0===i)return"Missing prefix for "+e;var o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)return"Data too short";var s=Fl(o);if("string"==typeof s)return s;for(var c=[],u=0;u=a.length||c.push(d)}return 1!==s?"Invalid checksum for "+e:{prefix:o,words:c}}function Ul(e,t,r,n){for(var i=0,o=0,a=(1<=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<=t)return"Excess padding";if(i<r)throw new TypeError("Exceeds length limit");var n=Fl(e=e.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=e+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");n=Bl(n)^a,i+=Tl.charAt(a)}for(o=0;o<6;++o)n=Bl(n);for(n^=1,o=0;o<6;++o){i+=Tl.charAt(n>>5*(5-o)&31)}return i},toWordsUnsafe:function(e){var t=Ul(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=Ul(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=Ul(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=Ul(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}},ql=f(Ll);const Hl="providers/5.7.2",Kl=new wo(Hl);class Jl{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),c=this.type.bind(this);return e.transaction={hash:o,type:c,accessList:Jl.allowNull(this.accessList.bind(this),null),blockHash:Jl.allowNull(o,null),blockNumber:Jl.allowNull(s,null),transactionIndex:Jl.allowNull(s,null),confirmations:Jl.allowNull(s,null),from:t,gasPrice:Jl.allowNull(r),maxPriorityFeePerGas:Jl.allowNull(r),maxFeePerGas:Jl.allowNull(r),gasLimit:r,to:Jl.allowNull(t,null),value:r,nonce:s,data:i,r:Jl.allowNull(this.uint256),s:Jl.allowNull(this.uint256),v:Jl.allowNull(s),creates:Jl.allowNull(t,null),raw:Jl.allowNull(i)},e.transactionRequest={from:Jl.allowNull(t),nonce:Jl.allowNull(s),gasLimit:Jl.allowNull(r),gasPrice:Jl.allowNull(r),maxPriorityFeePerGas:Jl.allowNull(r),maxFeePerGas:Jl.allowNull(r),to:Jl.allowNull(t),value:Jl.allowNull(r),data:Jl.allowNull((e=>this.data(e,!0))),type:Jl.allowNull(s),accessList:Jl.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:t,topics:Jl.arrayOf(o),data:i,logIndex:s,blockHash:o},e.receipt={to:Jl.allowNull(this.address,null),from:Jl.allowNull(this.address,null),contractAddress:Jl.allowNull(t,null),transactionIndex:s,root:Jl.allowNull(a),gasUsed:r,logsBloom:Jl.allowNull(i),blockHash:o,transactionHash:o,logs:Jl.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:Jl.allowNull(s,null),cumulativeGasUsed:r,effectiveGasPrice:Jl.allowNull(r),status:Jl.allowNull(s),type:c},e.block={hash:Jl.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:Jl.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Jl.allowNull(t),extraData:i,transactions:Jl.allowNull(Jl.arrayOf(o)),baseFeePerGas:Jl.allowNull(r)},e.blockWithTransactions=wa(e.block),e.blockWithTransactions.transactions=Jl.allowNull(Jl.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Jl.allowNull(n,void 0),toBlock:Jl.allowNull(n,void 0),blockHash:Jl.allowNull(o,void 0),address:Jl.allowNull(t,void 0),topics:Jl.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Jl.allowNull(s),blockHash:Jl.allowNull(o),transactionIndex:s,removed:Jl.allowNull(this.boolean.bind(this)),address:t,data:Jl.allowFalsish(i,"0x"),topics:Jl.arrayOf(o),transactionHash:o,logIndex:s},e}accessList(e){return Nf(e||[])}number(e){return"0x"===e?0:Zo.from(e).toNumber()}type(e){return"0x"===e||null==e?0:Zo.from(e).toNumber()}bigNumber(e){return Zo.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),No(e))?e.toLowerCase():Kl.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return ws(e)}callAddress(e){if(!No(e,32))return null;const t=ws(Do(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return As(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||No(e))return Bo(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==jo(r)?Kl.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=Zo.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!No(e))throw new Error("invalid uint256");return zo(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const r=null!=e._difficulty?e._difficulty:e.difficulty,n=Jl.check(t,e);return n._difficulty=null==r?null:Zo.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Jl.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&Zo.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=Jl.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;No(r)&&(r=Zo.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),No(r)&&(r=Zo.from(r).toNumber()),"number"!=typeof r&&null!=t.v&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),t.chainId=r}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return Bf(e)}receiptLog(e){return Jl.check(this.formats.receiptLog,e)}receipt(e){const t=Jl.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=Zo.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&Kl.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):Kl.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&Kl.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return Jl.check(this.formats.filter,e)}filterLog(e){return Jl.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const n in e)try{const i=e[n](t[n]);void 0!==i&&(r[n]=i)}catch(e){throw e.checkKey=n,e.checkValue=t[n],e}return r}static allowNull(e,t){return function(r){return null==r?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach((function(t){r.push(e(t))})),r}}}var Wl=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const Gl=new wo(Hl);function Vl(e){return null==e?"null":(32!==jo(e)&&Gl.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Zl(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[Vl(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return Vl(e)})).join("&")}function Xl(e){if("string"==typeof e){if(32===jo(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Zl(e);if(Eu.isForkEvent(e))throw Gl.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Zl(e.topics||[])}throw new Error("invalid event - "+e)}function Ql(){return(new Date).getTime()}function Yl(e){return new Promise((t=>{setTimeout(t,e)}))}const eh=["block","network","pending","poll"];class th{constructor(e,t,r){ga(this,"tag",e),ga(this,"listener",t),ga(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],r=""===(n=e[2])?[]:n.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var n;const i={};return r.length>0&&(i.topics=r),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||eh.indexOf(this.tag)>=0}}const rh={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function nh(e){return zo(Zo.from(e).toHexString(),32)}function ih(e){return nd.encode(Co([e,Do(cd(cd(e)),0,4)]))}const oh=new RegExp("^(ipfs)://(.*)$","i"),ah=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),oh,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function sh(e,t){try{return Vs(ch(e,t))}catch(e){}return null}function ch(e,t){if("0x"===e)return null;const r=Zo.from(Do(e,t,t+32)).toNumber(),n=Zo.from(Do(e,r,r+32)).toNumber();return Do(e,r+32,r+32+n)}function uh(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Gl.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function fh(e){const t=Mo(e);if(t.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(t,32-t.length),r}function dh(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function lh(e){const t=[];let r=0;for(let n=0;nZo.from(e).eq(1))).catch((e=>{if(e.code===wo.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return Wl(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:$o([e,Kc(this.name),t||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=$o(["0x9061b923",lh([Jc(this.name),r.data])]));try{let e=yield this.provider.call(r);return Mo(e).length%32==4&&Gl.throwError("resolver threw error",wo.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=ch(e,0)),e}catch(e){if(e.code===wo.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return Wl(this,void 0,void 0,(function*(){const r=yield this._fetch(e,t);return null!=r?ch(r,0):null}))}_getAddress(e,t){const r=rh[String(e)];if(null==r&&Gl.throwError(`unsupported coin type: ${e}`,wo.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=Mo(t);if(null!=r.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return ih(Co([[r.p2pkh],"0x"+e[2]]))}}if(null!=r.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return ih(Co([[r.p2sh],"0x"+e[2]]))}}if(null!=r.prefix){const e=n[1];let t=n[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&n.length===2+e&&e>=1&&e<=75){const e=ql.toWords(n.slice(2));return e.unshift(t),ql.encode(r.prefix,e)}}return null}getAddress(e){return Wl(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||e===Bs?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===wo.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",nh(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&Gl.throwError("invalid or unsupported coin data",wo.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return Wl(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let r=0;re[t]))}return Gl.throwError("invalid or unsupported content hash data",wo.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return Wl(this,void 0,void 0,(function*(){let t=Js(e);t=Co([nh(64),nh(t.length),t]),t.length%32!=0&&(t=Co([t,zo("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",To(t));return null==r||"0x"===r?null:Vs(r)}))}}let ph=null,mh=1;class gh extends Su{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ga(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=ya(new.target,"getNetwork")(e);t?(ga(this,"_network",t),this.emit("network",t,null)):Gl.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Wl(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||Gl.throwError("no network detected",wo.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:ga(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return Nl((()=>this._ready().then((e=>e),(e=>{if(e.code!==wo.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==ph&&(ph=new Jl),ph}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in El){const r=El[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=El[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=El[e.name];if(!t)return"number"!=typeof e.chainId&&yl.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&yl.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;var n;return null==r&&t._defaultProvider&&(r=(n=t._defaultProvider)&&"function"==typeof n.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}(null==e?"homestead":e)}ccipReadFetch(e,t,r){return Wl(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e=0?null:JSON.stringify({data:i,sender:n}),c=yield Rl({url:a,errorPassThrough:!0},s,((e,t)=>(e.status=t.statusCode,e)));if(c.data)return c.data;const u=c.message||"unknown error";if(c.status>=400&&c.status<500)return Gl.throwError(`response not found during CCIP fetch: ${u}`,wo.errors.SERVER_ERROR,{url:t,errorMessage:u});o.push(u)}return Gl.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,wo.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(e){return Wl(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const r=yield t;if(Ql()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=Ql(),r=ba({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=Ql();return(e=Zo.from(e).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return Wl(this,void 0,void 0,(function*(){const e=mh++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Gl.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Gl.makeError("network block skew detected",wo.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let e=this._emitted.block+1;e<=r;e++)this.emit("block",e);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&r-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((e=>{switch(e.type){case"tx":{const r=e.hash;let n=this.getTransactionReceipt(r).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+r]=e.blockNumber,this.emit(r,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(n);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=r-1);const n=e.filter;n.fromBlock=e._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=r,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Wl(this,void 0,void 0,(function*(){return Gl.throwError("provider does not support network detection",wo.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return Wl(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield Yl(0),this._network;const r=Gl.makeError("underlying network changed",wo.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=Ql();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return Wl(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return Wl(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const a=[];let s=!1;const c=function(){return!!s||(s=!0,a.forEach((e=>{e()})),!1)},u=e=>{e.confirmations{this.removeListener(e,u)})),n){let r=n.startBlock,i=null;const u=a=>Wl(this,void 0,void 0,(function*(){s||(yield Yl(1e3),this.getTransactionCount(n.from).then((f=>Wl(this,void 0,void 0,(function*(){if(!s){if(f<=n.nonce)r=a;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i{s||this.once("block",u)})))}));if(s)return;this.once("block",u),a.push((()=>{this.removeListener("block",u)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{c()||o(Gl.makeError("timeout exceeded",wo.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),a.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return Wl(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Zo.from(e)}catch(t){return Gl.throwError("bad result from backend",wo.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield ba({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return Zo.from(n)}catch(e){return Gl.throwError("bad result from backend",wo.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield ba({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return Zo.from(n).toNumber()}catch(e){return Gl.throwError("bad result from backend",wo.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield ba({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return To(n)}catch(e){return Gl.throwError("bad result from backend",wo.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ba({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>Bo(e)))}),i=yield this.perform("getStorageAt",n);try{return To(i)}catch(e){return Gl.throwError("bad result from backend",wo.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==jo(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&Gl.throwError("Transaction hash mismatch from Provider.sendTransaction.",wo.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>Wl(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==n&&(n=0),0!==t&&null!=r&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const o=yield this._waitForTransaction(e.hash,t,n,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&Gl.throwError("transaction failed",wo.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),n}sendTransaction(e){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>To(e))),r=this.formatter.transaction(e);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,e,n)}catch(e){throw e.transaction=r,e.transactionHash=r.hash,e}}))}_getTransactionRequest(e){return Wl(this,void 0,void 0,(function*(){const t=yield e,r={};return["from","to"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?Zo.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?To(e):null)))})),this.formatter.transactionRequest(yield ba(r))}))}_getFilter(e){return Wl(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((r=>{null!=e[r]&&(t[r]=e[r])})),["fromBlock","toBlock"].forEach((r=>{null!=e[r]&&(t[r]=this._getBlockTag(e[r]))})),this.formatter.filter(yield ba(t))}))}_call(e,t,r){return Wl(this,void 0,void 0,(function*(){r>=10&&Gl.throwError("CCIP read exceeded maximum redirections",wo.errors.SERVER_ERROR,{redirects:r,transaction:e});const n=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&"latest"===t&&null!=n&&"0x556f1830"===i.substring(0,10)&&jo(i)%32==4)try{const o=Do(i,4),a=Do(o,0,32);Zo.from(a).eq(n)||Gl.throwError("CCIP Read sender did not match",wo.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const s=[],c=Zo.from(Do(o,32,64)).toNumber(),u=Zo.from(Do(o,c,c+32)).toNumber(),f=Do(o,c+32);for(let t=0;tWl(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",n);if(null==e)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;rthis._wrapTransaction(e))),r}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Nl((()=>Wl(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(e){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Nl((()=>Wl(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return n}))),{oncePoll:this})}))}getLogs(e){return Wl(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield ba({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),Jl.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return Wl(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return Wl(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&Gl.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return Wl(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const r=yield this._getResolver(t,"getResolver");if(null!=r){const n=new hh(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return Wl(this,void 0,void 0,(function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Gl.throwError("network does not support ENS",wo.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Kc(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return Wl(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(No(e))throw t}"string"!=typeof e&&Gl.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return Wl(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(null==r)return null;const n=sh(yield this.call({to:r,data:"0x691f3431"+Kc(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n}))}getAvatar(e){return Wl(this,void 0,void 0,(function*(){let t=null;if(No(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new hh(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==wo.errors.CALL_EXCEPTION)throw e}try{const e=sh(yield this.call({to:n,data:"0x691f3431"+Kc(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==wo.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return null==r?null:r.url}))}perform(e,t){return Gl.throwError(e+" not implemented",wo.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,r){const n=new th(Xl(e),t,r);return this._events.push(n),this._startEvent(n),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,n=[],i=Xl(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),r=!0,!e.once||(n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),r}listenerCount(e){if(!e)return this._events.length;let t=Xl(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=Xl(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const r=[];let n=!1,i=Xl(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!n||(n=!0,r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const r=Xl(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var yh=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const bh=new wo(Hl),vh=["call","estimateGas"];function wh(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=No(e.data)?e.data:null;if(!t||r)return{message:e.message,data:r}}if("object"==typeof e){for(const r in e){const n=wh(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return wh(JSON.parse(e),t)}catch(e){}return null}function Ah(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=wh(t,!0);if(e)return e.data;bh.throwError("missing revert data in call exception; Transaction reverted without a reason string",wo.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=wh(t.body,!1);null==r&&(r=wh(t,!1)),r&&bh.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",wo.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===wo.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&bh.throwError("insufficient funds for intrinsic transaction cost",wo.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&bh.throwError("nonce has already been used",wo.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&bh.throwError("replacement fee too low",wo.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&bh.throwError("legacy pre-eip-155 transactions not supported",wo.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),vh.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&bh.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",wo.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function _h(e){return new Promise((function(t){setTimeout(t,e)}))}function Eh(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function Sh(e){return e?e.toLowerCase():e}const Ph={};class xh extends Cu{constructor(e,t,r){if(super(),e!==Ph)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ga(this,"provider",t),null==r&&(r=0),"string"==typeof r?(ga(this,"_address",this.provider.formatter.address(r)),ga(this,"_index",null)):"number"==typeof r?(ga(this,"_index",r),ga(this,"_address",null)):bh.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return bh.throwError("cannot alter JSON-RPC Signer connection",wo.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new kh(Ph,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&bh.throwError("unknown account #"+this._index,wo.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=wa(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=wa(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>yh(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&bh.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),ba({tx:ba(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&bh.throwArgumentError("from address mismatch","transaction",e):t.from=r;const n=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&bh.throwError("user rejected transaction",wo.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),Ah("sendTransaction",e,n))))}))}signTransaction(e){return bh.throwError("signing transactions is unsupported",wo.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return yh(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield Nl((()=>yh(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(r);if(null!==e)return this.provider._wrapTransaction(e,r,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=r,e}}))}signMessage(e){return yh(this,void 0,void 0,(function*(){const t="string"==typeof e?Js(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[To(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&bh.throwError("user rejected signing",wo.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}}))}_legacySignMessage(e){return yh(this,void 0,void 0,(function*(){const t="string"==typeof e?Js(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),To(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&bh.throwError("user rejected signing",wo.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}}))}_signTypedData(e,t,r){return yh(this,void 0,void 0,(function*(){const n=yield fu.resolveNames(e,t,r,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(fu.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&bh.throwError("user rejected signing",wo.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}}))}unlock(e){return yh(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class kh extends xh{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const Mh={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Ch extends gh{constructor(e,t){let r=t;null==r&&(r=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(r),e||(e=ya(this.constructor,"defaultUrl")()),ga(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(wa(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return yh(this,void 0,void 0,(function*(){yield _h(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=ya(this.constructor,"getNetwork");try{return t(Zo.from(e).toNumber())}catch(t){return bh.throwError("could not detect network",wo.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return bh.throwError("could not detect network",wo.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new xh(Ph,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Sa(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=Rl(this.connection,JSON.stringify(r),Eh).then((e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:r,provider:this}),e}));return n&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Sh(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Sh(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Sh(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Sh(t.address),zo(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[ya(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[ya(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Sh(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return yh(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&Zo.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=wa(t)).transaction=wa(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&bh.throwError(e+" not implemented",wo.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return Ah(e,r,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return _h(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((e=>{}))}(),r})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=wa(Mh);if(t)for(const e in t)t[e]&&(r[e]=!0);va(e,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=Bo(Zo.from(e[t]));"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=To(e[t]))})),e.accessList&&(n.accessList=Nf(e.accessList)),n}}const Ih=new RegExp("^bytes([0-9]+)$"),Rh=new RegExp("^(u?int)([0-9]*)$"),Nh=new RegExp("^(.*)\\[([0-9]*)\\]$"),Oh="0000000000000000000000000000000000000000000000000000000000000000",Th=new wo("solidity/5.7.0");function jh(e,t,r){switch(e){case"address":return r?Ro(t,32):Mo(t);case"string":return Js(t);case"bytes":return Mo(t);case"bool":return t=t?"0x01":"0x00",r?Ro(t,32):Mo(t)}let n=e.match(Rh);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&Th.throwArgumentError("invalid number type","type",e),r&&(i=256),Ro(t=Zo.from(t).toTwos(i),i/8)}if(n=e.match(Ih),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&Th.throwArgumentError("invalid bytes type","type",e),Mo(t).byteLength!==i&&Th.throwArgumentError(`invalid value for ${e}`,"value",t),r?Mo((t+Oh).substring(0,66)):t}if(n=e.match(Nh),n&&Array.isArray(t)){const r=n[1];parseInt(n[2]||String(t.length))!=t.length&&Th.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(jh(r,e,!0))})),Co(i)}return Th.throwArgumentError("invalid type","type",e)}function Dh(e,t){e.length!=t.length&&Th.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(jh(e,t[n]))})),To(Co(r))}var $h=Object.freeze({__proto__:null,keccak256:function(e,t){return is(Dh(e,t))},pack:Dh,sha256:function(e,t){return cd(Dh(e,t))}});const Bh=new wo("units/5.7.0"),Fh=["wei","kwei","mwei","gwei","szabo","finney","ether"];function zh(e,t){if("string"==typeof t){const e=Fh.indexOf(t);-1!==e&&(t=3*e)}return ca(e,null!=t?t:18)}function Uh(e,t){if("string"!=typeof e&&Bh.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=Fh.indexOf(t);-1!==e&&(t=3*e)}return ua(e,null!=t?t:18)}var Lh=Object.freeze({__proto__:null,commify:function(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&Bh.throwArgumentError("invalid value","value",e);let r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const e=r.length-3;o.unshift(r.substring(e)),r=r.substring(0,e)}}return n+o.join(",")+i},formatEther:function(e){return zh(e,18)},formatUnits:zh,parseEther:function(e){return Uh(e,18)},parseUnits:Uh});function qh(e){if(null==e.match(/^(0x)?([\da-fA-F]{40})$/))throw new RangeError("incorrect address format");try{return ws(oo(e,!0,20))}catch(e){throw new an(e,["invalid EIP-55 address"])}}async function Hh(e){return n(await so(ro(e),"SHA-256"),!0,!1)}async function Kh(e,t){if(void 0===e.iss)throw new Error('Payload iss should be set to either "orig" or "dest"');const r=JSON.parse(e.exchange[e.iss]);await Yi(r,t);const n=await Wi(t),i=t.alg,o={...e,iat:Math.floor(Date.now()/1e3)};return{jws:await new Hi(o).setProtectedHeader({alg:i}).setIssuedAt(o.iat).sign(n),payload:o}}async function Jh(e,t,r){const n=JSON.parse(t.exchange[t.iss]),i=await Zi(e,n);if(void 0===i.payload.iss)throw new Error('Property "iss" missing');if(void 0===i.payload.iat)throw new Error("Property claim iat missing");if(void 0!==r){no("iat"===r.timestamp?1e3*i.payload.iat:r.timestamp,"iat"===r.notBefore?1e3*i.payload.iat:r.notBefore,"iat"===r.notAfter?1e3*i.payload.iat:r.notAfter,r.tolerance)}const o=i.payload,a=o.exchange[o.iss];if(ro(n)!==ro(JSON.parse(a)))throw new Error(`The proof is issued by ${a} instead of ${JSON.stringify(n)}`);const s=t;for(const e in s){if(void 0===o[e])throw new Error(`Expected key '${e}' not found in proof`);if("exchange"===e){const e=t.exchange;Wh(o.exchange,e)}else if(""!==s[e]&&ro(s[e])!==ro(o[e]))throw new Error(`Proof's ${e}: ${JSON.stringify(o[e],void 0,2)} does not meet provided value ${JSON.stringify(s[e],void 0,2)}`)}return i}function Wh(e,t){const r=["id","orig","dest","hashAlg","cipherblockDgst","blockCommitment","blockCommitment","secretCommitment","schema"];for(const t of r)if("schema"!==t&&(void 0===e[t]||""===e[t]))throw new Error(`${t} is missing on dataExchange.\ndataExchange: ${JSON.stringify(e,void 0,2)}`);for(const r in t)if(""!==t[r]&&ro(t[r])!==ro(e[r]))throw new Error(`dataExchange's ${r}: ${JSON.stringify(e[r],void 0,2)} does not meet expected value ${JSON.stringify(t[r],void 0,2)}`)}async function Gh(e,t,r=10){const{payload:n}=await Zi(e),i=n.exchange,o={...i};delete o.id;if(await Hh(o)!==i.id)throw new an(new Error("data exchange integrity failed"),["dataExchange integrity violated"]);const a=JSON.parse(i.dest),s=JSON.parse(i.orig);let c,u,f;try{c=(await Jh(n.poo,{iss:"orig",proofType:"PoO",exchange:i})).payload}catch(e){throw new an(e,["invalid poo"])}try{await Jh(e,{iss:"dest",proofType:"PoR",exchange:i},{timestamp:"iat",notBefore:1e3*c.iat,notAfter:1e3*c.iat+i.pooToPorDelay})}catch(e){throw new an(e,["invalid por"])}try{const e=await t.getSecretFromLedger(Xi(i.encAlg),i.ledgerSignerAddress,i.id,r);u=e.hex,f=e.iat}catch(e){throw new an(e,["cannot verify"])}try{no(1e3*f,1e3*n.iat,1e3*c.iat+i.pooToSecretDelay)}catch(e){throw new an(`Although the secret has been obtained (and you could try to decrypt the cipherblock), it's been published later than agreed: ${new Date(1e3*f).toUTCString()} > ${new Date(1e3*c.iat+i.pooToSecretDelay).toUTCString()}`,["secret not published in time"])}return{pooPayload:c,porPayload:n,secretHex:u,destPublicJwk:a,origPublicJwk:s}}async function Vh(e,t,r=10){let n,i,o,a,s;try{n=(await Zi(e)).payload}catch(e){throw new an(e,["invalid verification request"])}try{const e=await Gh(n.por,t,r);i=e.destPublicJwk,o=e.origPublicJwk,a=e.pooPayload,s=e.porPayload}catch(e){throw new an(e,["invalid por","invalid verification request"])}try{await Zi(e,"dest"===n.iss?i:o)}catch(e){throw new an(e,["invalid verification request"])}return{pooPayload:a,porPayload:s,vrPayload:n,destPublicJwk:i,origPublicJwk:o}}async function Zh(e,t){const{payload:r}=await Zi(e),{destPublicJwk:i,origPublicJwk:o,secretHex:a,pooPayload:s,porPayload:c}=await Gh(r.por,t);try{await Zi(e,i)}catch(e){throw e instanceof an&&e.add("invalid dispute request"),e}if(n(await so(r.cipherblock,c.exchange.hashAlg),!0,!1)!==c.exchange.cipherblockDgst)throw new an(new Error("cipherblock does not meet the committed (and already accepted) one"),["invalid dispute request"]);return await Vi(r.cipherblock,(await Qi(c.exchange.encAlg,a)).jwk),{pooPayload:s,porPayload:c,drPayload:r,destPublicJwk:i,origPublicJwk:o}}async function Xh(e,t,r,n){const i={proofType:"request",iss:e,dataExchangeId:t,por:r,type:"verificationRequest",iat:Math.floor(Date.now()/1e3)},o=await mi(n);return await new Hi(i).setProtectedHeader({alg:n.alg}).setIssuedAt(i.iat).sign(o)}var Qh=Object.freeze({__proto__:null,ConflictResolver:class{constructor(e,t){this.jwkPair=e,this.dltAgent=t,this.initialized=new Promise(((e,t)=>{this.init().then((()=>{e(!0)})).catch((e=>{t(e)}))}))}async init(){await Yi(this.jwkPair.publicJwk,this.jwkPair.privateJwk)}async resolveCompleteness(e){await this.initialized;const{payload:t}=await Zi(e);let r;try{r=(await Zi(t.por)).payload}catch(e){throw new an(e,["invalid por"])}const n={...await this._resolution(t.dataExchangeId,r.exchange[t.iss]),resolution:"not completed",type:"verification"};try{await Vh(e,this.dltAgent),n.resolution="completed"}catch(e){if(!(e instanceof an)||e.nrErrors.includes("invalid verification request")||e.nrErrors.includes("unexpected error"))throw e}const i=await mi(this.jwkPair.privateJwk);return await new Hi(n).setProtectedHeader({alg:this.jwkPair.privateJwk.alg}).setIssuedAt(n.iat).sign(i)}async resolveDispute(e){await this.initialized;const{payload:t}=await Zi(e);let r;try{r=(await Zi(t.por)).payload}catch(e){throw new an(e,["invalid por"])}const n={...await this._resolution(t.dataExchangeId,r.exchange[t.iss]),resolution:"denied",type:"dispute"};try{await Zh(e,this.dltAgent)}catch(e){if(!(e instanceof an&&e.nrErrors.includes("decryption failed")))throw new an(e,["cannot verify"]);n.resolution="accepted"}const i=await mi(this.jwkPair.privateJwk);return await new Hi(n).setProtectedHeader({alg:this.jwkPair.privateJwk.alg}).setIssuedAt(n.iat).sign(i)}async _resolution(e,t){return{proofType:"resolution",dataExchangeId:e,iat:Math.floor(Date.now()/1e3),iss:await ao(this.jwkPair.publicJwk,!0),sub:t}}},checkCompleteness:Vh,checkDecryption:Zh,generateVerificationRequest:Xh,verifyPor:Gh,verifyResolution:async function(e,t){return await Zi(e,t??((e,t)=>JSON.parse(t.iss)))}});const Yh={gasLimit:125e5,contract:{address:"0x8d407A1722633bDD1dcf221474be7a44C05d7c2F",abi:[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"dataExchangeId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"secret",type:"uint256"}],name:"Registration",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"registry",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"},{internalType:"uint256",name:"secret",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_dataExchangeId",type:"uint256"},{internalType:"uint256",name:"_secret",type:"uint256"}],name:"setRegistry",outputs:[],stateMutability:"nonpayable",type:"function"}],transactionHash:"0x6a3828f8fe232819dc40ca66f93930b3bd1619db31a67ec34b44446b3e7c8289",receipt:{to:null,from:"0x17bd12C2134AfC1f6E9302a532eFE30C19B9E903",contractAddress:"0x8d407A1722633bDD1dcf221474be7a44C05d7c2F",transactionIndex:0,gasUsed:"253928",logsBloom:"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",blockHash:"0x0118672bb9b27679e616831d056d36291dd20cfe88c3ee2abd8f2dfce579cad4",transactionHash:"0x6a3828f8fe232819dc40ca66f93930b3bd1619db31a67ec34b44446b3e7c8289",logs:[],blockNumber:119389,cumulativeGasUsed:"253928",status:1,byzantium:!0},args:[],solcInputHash:"c528a37588793ef74285d75e08d6b8eb",metadata:'{"compiler":{"version":"0.8.4+commit.c7e474f2"},"language":"Solidity","output":{"abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"dataExchangeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secret","type":"uint256"}],"name":"Registration","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"registry","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"secret","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dataExchangeId","type":"uint256"},{"internalType":"uint256","name":"_secret","type":"uint256"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"contracts/NonRepudiation.sol":"NonRepudiation"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs","useLiteralContent":true},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"contracts/NonRepudiation.sol":{"content":"//SPDX-License-Identifier: Unlicense\\npragma solidity ^0.8.0;\\n\\ncontract NonRepudiation {\\n struct Proof {\\n uint256 timestamp;\\n uint256 secret;\\n }\\n mapping(address => mapping (uint256 => Proof)) public registry;\\n event Registration(address sender, uint256 dataExchangeId, uint256 timestamp, uint256 secret);\\n\\n function setRegistry(uint256 _dataExchangeId, uint256 _secret) public {\\n require(registry[msg.sender][_dataExchangeId].secret == 0);\\n registry[msg.sender][_dataExchangeId] = Proof(block.timestamp, _secret);\\n emit Registration(msg.sender, _dataExchangeId, block.timestamp, _secret);\\n }\\n}\\n","keccak256":"0x8d371257a9b03c9102f158323e61f56ce49dd8489bd92c5a7d8abc3d9f6f8399","license":"Unlicense"}},"version":1}',bytecode:"0x608060405234801561001057600080fd5b506103a2806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063032439371461003b578063d05cb54514610057575b600080fd5b6100556004803603810190610050919061023a565b610088565b005b610071600480360381019061006c91906101fe565b6101a3565b60405161007f9291906102d9565b60405180910390f35b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060010154146100e757600080fd5b6040518060400160405280428152602001828152506000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060008201518160000155602082015181600101559050507faa58599838af2e5e0f3251cfbb4eac5d5d447ded49f6b0ac28d6b44098224e63338342846040516101979493929190610294565b60405180910390a15050565b6000602052816000526040600020602052806000526040600020600091509150508060000154908060010154905082565b6000813590506101e38161033e565b92915050565b6000813590506101f881610355565b92915050565b6000806040838503121561021157600080fd5b600061021f858286016101d4565b9250506020610230858286016101e9565b9150509250929050565b6000806040838503121561024d57600080fd5b600061025b858286016101e9565b925050602061026c858286016101e9565b9150509250929050565b61027f81610302565b82525050565b61028e81610334565b82525050565b60006080820190506102a96000830187610276565b6102b66020830186610285565b6102c36040830185610285565b6102d06060830184610285565b95945050505050565b60006040820190506102ee6000830185610285565b6102fb6020830184610285565b9392505050565b600061030d82610314565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b61034781610302565b811461035257600080fd5b50565b61035e81610334565b811461036957600080fd5b5056fea26469706673582212204fd0fc653fb487221da9a14a4ca5d5499f9e9bc7b27ac8ab0f8d397fd6e3148564736f6c63430008040033",deployedBytecode:"0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063032439371461003b578063d05cb54514610057575b600080fd5b6100556004803603810190610050919061023a565b610088565b005b610071600480360381019061006c91906101fe565b6101a3565b60405161007f9291906102d9565b60405180910390f35b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060010154146100e757600080fd5b6040518060400160405280428152602001828152506000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060008201518160000155602082015181600101559050507faa58599838af2e5e0f3251cfbb4eac5d5d447ded49f6b0ac28d6b44098224e63338342846040516101979493929190610294565b60405180910390a15050565b6000602052816000526040600020602052806000526040600020600091509150508060000154908060010154905082565b6000813590506101e38161033e565b92915050565b6000813590506101f881610355565b92915050565b6000806040838503121561021157600080fd5b600061021f858286016101d4565b9250506020610230858286016101e9565b9150509250929050565b6000806040838503121561024d57600080fd5b600061025b858286016101e9565b925050602061026c858286016101e9565b9150509250929050565b61027f81610302565b82525050565b61028e81610334565b82525050565b60006080820190506102a96000830187610276565b6102b66020830186610285565b6102c36040830185610285565b6102d06060830184610285565b95945050505050565b60006040820190506102ee6000830185610285565b6102fb6020830184610285565b9392505050565b600061030d82610314565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b61034781610302565b811461035257600080fd5b50565b61035e81610334565b811461036957600080fd5b5056fea26469706673582212204fd0fc653fb487221da9a14a4ca5d5499f9e9bc7b27ac8ab0f8d397fd6e3148564736f6c63430008040033",devdoc:{kind:"dev",methods:{},version:1},userdoc:{kind:"user",methods:{},version:1},storageLayout:{storage:[{astId:13,contract:"contracts/NonRepudiation.sol:NonRepudiation",label:"registry",offset:0,slot:"0",type:"t_mapping(t_address,t_mapping(t_uint256,t_struct(Proof)6_storage))"}],types:{t_address:{encoding:"inplace",label:"address",numberOfBytes:"20"},"t_mapping(t_address,t_mapping(t_uint256,t_struct(Proof)6_storage))":{encoding:"mapping",key:"t_address",label:"mapping(address => mapping(uint256 => struct NonRepudiation.Proof))",numberOfBytes:"32",value:"t_mapping(t_uint256,t_struct(Proof)6_storage)"},"t_mapping(t_uint256,t_struct(Proof)6_storage)":{encoding:"mapping",key:"t_uint256",label:"mapping(uint256 => struct NonRepudiation.Proof)",numberOfBytes:"32",value:"t_struct(Proof)6_storage"},"t_struct(Proof)6_storage":{encoding:"inplace",label:"struct NonRepudiation.Proof",members:[{astId:3,contract:"contracts/NonRepudiation.sol:NonRepudiation",label:"timestamp",offset:0,slot:"0",type:"t_uint256"},{astId:5,contract:"contracts/NonRepudiation.sol:NonRepudiation",label:"secret",offset:0,slot:"1",type:"t_uint256"}],numberOfBytes:"64"},t_uint256:{encoding:"inplace",label:"uint256",numberOfBytes:"32"}}}}};async function ep(e,t,r,n,o){let s=Zo.from(0),c=Zo.from(0);const u=oo(a(i(r)),!0);let f=0;do{try{({secret:s,timestamp:c}=await e.registry(oo(t,!0),u))}catch(e){throw new an(e,["cannot contact the ledger"])}s.isZero()&&(f++,await new Promise((e=>setTimeout(e,1e3))))}while(s.isZero()&&f{null!==e&&"object"==typeof e&&"function"==typeof e.then?e.then((e=>{this.dltConfig={...Yh,...e},this.provider=new Ch(this.dltConfig.rpcProviderUrl),this.contract=new ed(this.dltConfig.contract.address,this.dltConfig.contract.abi,this.provider),t(!0)})).catch((e=>r(e))):(this.dltConfig={...Yh,...e},this.provider=new Ch(this.dltConfig.rpcProviderUrl),this.contract=new ed(this.dltConfig.contract.address,this.dltConfig.contract.abi,this.provider),t(!0))}))}async getContractAddress(){return await this.initialized,this.contract.address}}class ip extends np{async getSecretFromLedger(e,t,r,n){return await this.initialized,await ep(this.contract,t,r,n,e)}}class op extends np{constructor(e,t,r){const n=new Promise(((t,n)=>{e.providerinfo.get().then((e=>{const i=e.rpcUrl;void 0===i?n(new Error("wallet is not connected to RPC endpoint")):t({...r,rpcProviderUrl:"string"==typeof i?i:i[0]})})).catch((e=>{n(e)}))}));super(n),this.wallet=e,this.did=t}}class ap extends op{async getSecretFromLedger(e,t,r,n){return await this.initialized,await ep(this.contract,t,r,n,e)}}class sp extends np{constructor(e,t,r){const n=new Promise(((t,n)=>{e.providerinfoGet().then((e=>{const i=e.rpcUrl;void 0===i?n(new Error("wallet is not connected to RPC endpoint")):t({...r,rpcProviderUrl:"string"==typeof i?i:i[0]})})).catch((e=>{n(e)}))}));super(n),this.wallet=e,this.did=t}}class cp extends sp{async getSecretFromLedger(e,t,r,n){return await this.initialized,await ep(this.contract,t,r,n,e)}}var up={},fp=d(wu),dp=d(_s),lp=d(vc),hp=d(od),pp=d(qo),mp=d(du),gp=d(Nd),yp=d(ll),bp=d(os),vp=d(Ao),wp=d(fd),Ap=d($h),_p=d($d),Ep=d(xa),Sp=d(ps),Pp=d(Af),xp=d(sc),kp=d(Ff),Mp=d(Lh),Cp=d(gl),Ip=d(Ol);!function(e){var t=u&&u.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=u&&u.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=u&&u.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=fp;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var o=dp;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return o.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return o.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return o.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return o.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return o.isAddress}});var a=n(lp);e.base64=a;var s=hp;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=pp;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return c.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return c.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return c.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return c.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return c.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return c.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return c.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return c.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return c.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return c.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return c.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return c.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return c.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return c.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return c.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return c.stripZeros}});var f=mp;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return f._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return f.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return f.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return f.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return f.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return f.namehash}});var d=gp;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var l=yp;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return l.getJsonWalletAddress}});var h=bp;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var p=vp;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return p.Logger}});var m=wp;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return m.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return m.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return m.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return m.sha512}});var g=Ap;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return g.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return g.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return g.sha256}});var y=_p;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return y.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return y.shuffled}});var b=Ep;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return b.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return b.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return b.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return b.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return b.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return b.shallowCopy}});var v=n(Sp);e.RLP=v;var w=Pp;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return w.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return w.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return w.SigningKey}});var A=xp;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return A.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return A.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return A.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return A._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return A.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return A.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return A.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return A.Utf8ErrorFuncs}});var _=kp;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var E=Mp;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return E.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return E.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return E.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return E.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return E.parseUnits}});var S=Cp;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return S.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return S.verifyTypedData}});var P=Ip;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return P._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return P.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return P.poll}});var x=wp;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return x.SupportedAlgorithm}});var k=xp;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return k.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return k.Utf8ErrorReason}})}(up);class Rp extends np{constructor(e,t){let r;super(e),this.count=-1,r=void 0===t?function(e,t=!1){if(e<1)throw new RangeError("byteLength MUST be > 0");{const r=new Uint8Array(e);if(e<=65536)self.crypto.getRandomValues(r);else for(let t=0;tthis.count&&(this.count=e),this.count}}class Np extends op{constructor(){super(...arguments),this.count=-1}async deploySecret(e,t){await this.initialized;const r=await tp(e,t,this),n=(await this.wallet.identities.sign({did:this.did},{type:"Transaction",data:r})).signature,i=await this.provider.sendTransaction(n);return this.count=this.count+1,i.hash}async getAddress(){await this.initialized;const e=await this.wallet.identities.info({did:this.did});if(void 0===e.addresses)throw new an(new Error("no addresses for did "+this.did),["unexpected error"]);return e.addresses[0]}async nextNonce(){await this.initialized;const e=await this.provider.getTransactionCount(await this.getAddress(),"pending");return e>this.count&&(this.count=e),this.count}}class Op extends sp{constructor(){super(...arguments),this.count=-1}async deploySecret(e,t){await this.initialized;const r=await tp(e,t,this),n=(await this.wallet.identitySign({did:this.did},{type:"Transaction",data:r})).signature,i=await this.provider.sendTransaction(n);return this.count=this.count+1,i.hash}async getAddress(){await this.initialized;const e=await this.wallet.identityInfo({did:this.did});if(void 0===e.addresses)throw new an(`Can't get address for did: ${this.did}`,["unexpected error"]);return e.addresses[0]}async nextNonce(){await this.initialized;const e=await this.provider.getTransactionCount(await this.getAddress(),"pending");return e>this.count&&(this.count=e),this.count}}var Tp=Object.freeze({__proto__:null,EthersIoAgentDest:ip,EthersIoAgentOrig:Rp,I3mServerWalletAgentDest:cp,I3mServerWalletAgentOrig:Op,I3mWalletAgentDest:ap,I3mWalletAgentOrig:Np}),jp={schemas:{IdentitySelectOutput:{title:"IdentitySelectOutput",type:"object",properties:{did:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},required:["did"]},SignInput:{title:"SignInput",oneOf:[{title:"SignTransaction",type:"object",properties:{type:{enum:["Transaction"]},data:{title:"Transaction",type:"object",additionalProperties:!0,properties:{from:{type:"string"},to:{type:"string"},nonce:{type:"number"}}}},required:["type","data"]},{title:"SignRaw",type:"object",properties:{type:{enum:["Raw"]},data:{type:"object",properties:{payload:{description:"Base64Url encoded data to sign",type:"string",pattern:"^[A-Za-z0-9_-]+$"}},required:["payload"]}},required:["type","data"]},{title:"SignJWT",type:"object",properties:{type:{enum:["JWT"]},data:{type:"object",properties:{header:{description:'header fields to be added to the JWS header. "alg" and "kid" will be ignored since they are automatically added by the wallet.',type:"object",additionalProperties:!0},payload:{description:"A JSON object to be signed by the wallet. It will become the payload of the generated JWS. 'iss' (issuer) and 'iat' (issued at) will be automatically added by the wallet and will override provided values.",type:"object",additionalProperties:!0}},required:["payload"]}},required:["type","data"]}]},SignRaw:{title:"SignRaw",type:"object",properties:{type:{enum:["Raw"]},data:{type:"object",properties:{payload:{description:"Base64Url encoded data to sign",type:"string",pattern:"^[A-Za-z0-9_-]+$"}},required:["payload"]}},required:["type","data"]},SignTransaction:{title:"SignTransaction",type:"object",properties:{type:{enum:["Transaction"]},data:{title:"Transaction",type:"object",additionalProperties:!0,properties:{from:{type:"string"},to:{type:"string"},nonce:{type:"number"}}}},required:["type","data"]},SignJWT:{title:"SignJWT",type:"object",properties:{type:{enum:["JWT"]},data:{type:"object",properties:{header:{description:'header fields to be added to the JWS header. "alg" and "kid" will be ignored since they are automatically added by the wallet.',type:"object",additionalProperties:!0},payload:{description:"A JSON object to be signed by the wallet. It will become the payload of the generated JWS. 'iss' (issuer) and 'iat' (issued at) will be automatically added by the wallet and will override provided values.",type:"object",additionalProperties:!0}},required:["payload"]}},required:["type","data"]},Transaction:{title:"Transaction",type:"object",additionalProperties:!0,properties:{from:{type:"string"},to:{type:"string"},nonce:{type:"number"}}},SignOutput:{title:"SignOutput",type:"object",properties:{signature:{type:"string"}},required:["signature"]},Receipt:{title:"Receipt",type:"object",properties:{receipt:{type:"string"}},required:["receipt"]},SignTypes:{title:"SignTypes",type:"string",enum:["Transaction","Raw","JWT"]},IdentityListInput:{title:"IdentityListInput",description:"A list of DIDs",type:"array",items:{type:"object",properties:{did:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},required:["did"]}},IdentityCreateInput:{title:"IdentityCreateInput",description:'Besides the here defined options, provider specific properties should be added here if necessary, e.g. "path" for BIP21 wallets, or the key algorithm (if the wallet supports multiple algorithm).\n',type:"object",properties:{alias:{type:"string"}},additionalProperties:!0},IdentityCreateOutput:{title:"IdentityCreateOutput",description:"It returns the account id and type\n",type:"object",properties:{did:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},additionalProperties:!0,required:["did"]},ResourceListOutput:{title:"ResourceListOutput",description:"A list of resources",type:"array",items:{title:"Resource",anyOf:[{title:"VerifiableCredential",type:"object",properties:{type:{example:"VerifiableCredential",enum:["VerifiableCredential"]},name:{type:"string",example:"Resource name"},resource:{type:"object",properties:{"@context":{type:"array",items:{type:"string"},example:["https://www.w3.org/2018/credentials/v1"]},id:{type:"string",example:"http://example.edu/credentials/1872"},type:{type:"array",items:{type:"string"},example:["VerifiableCredential"]},issuer:{type:"object",properties:{id:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},additionalProperties:!0,required:["id"]},issuanceDate:{type:"string",format:"date-time",example:"2021-06-10T19:07:28.000Z"},credentialSubject:{type:"object",properties:{id:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},required:["id"],additionalProperties:!0},proof:{type:"object",properties:{type:{type:"string",enum:["JwtProof2020"]}},required:["type"],additionalProperties:!0}},additionalProperties:!0,required:["@context","type","issuer","issuanceDate","credentialSubject","proof"]}},required:["type","resource"]},{title:"ObjectResource",type:"object",properties:{type:{example:"Object",enum:["Object"]},name:{type:"string",example:"Resource name"},parentResource:{type:"string"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",additionalProperties:!0}},required:["type","resource"]},{title:"JWK pair",type:"object",properties:{type:{example:"KeyPair",enum:["KeyPair"]},name:{type:"string",example:"Resource name"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",properties:{keyPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]}},required:["keyPair"]}},required:["type","resource"]},{title:"Contract",type:"object",properties:{type:{example:"Contract",enum:["Contract"]},name:{type:"string",example:"Resource name"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",properties:{dataSharingAgreement:{type:"object",required:["dataOfferingDescription","parties","purpose","duration","intendedUse","licenseGrant","dataStream","personalData","pricingModel","dataExchangeAgreement","signatures"],properties:{dataOfferingDescription:{type:"object",required:["dataOfferingId","version","active"],properties:{dataOfferingId:{type:"string"},version:{type:"integer"},category:{type:"string"},active:{type:"boolean"},title:{type:"string"}}},parties:{type:"object",required:["providerDid","consumerDid"],properties:{providerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},consumerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}}},purpose:{type:"string"},duration:{type:"object",required:["creationDate","startDate","endDate"],properties:{creationDate:{type:"integer"},startDate:{type:"integer"},endDate:{type:"integer"}}},intendedUse:{type:"object",required:["processData","shareDataWithThirdParty","editData"],properties:{processData:{type:"boolean"},shareDataWithThirdParty:{type:"boolean"},editData:{type:"boolean"}}},licenseGrant:{type:"object",required:["transferable","exclusiveness","paidUp","revocable","processing","modifying","analyzing","storingData","storingCopy","reproducing","distributing","loaning","selling","renting","furtherLicensing","leasing"],properties:{transferable:{type:"boolean"},exclusiveness:{type:"boolean"},paidUp:{type:"boolean"},revocable:{type:"boolean"},processing:{type:"boolean"},modifying:{type:"boolean"},analyzing:{type:"boolean"},storingData:{type:"boolean"},storingCopy:{type:"boolean"},reproducing:{type:"boolean"},distributing:{type:"boolean"},loaning:{type:"boolean"},selling:{type:"boolean"},renting:{type:"boolean"},furtherLicensing:{type:"boolean"},leasing:{type:"boolean"}}},dataStream:{type:"boolean"},personalData:{type:"boolean"},pricingModel:{type:"object",required:["basicPrice","currency","hasFreePrice"],properties:{paymentType:{type:"string"},pricingModelName:{type:"string"},basicPrice:{type:"number",format:"float"},currency:{type:"string"},fee:{type:"number",format:"float"},hasPaymentOnSubscription:{type:"object",properties:{paymentOnSubscriptionName:{type:"string"},paymentType:{type:"string"},timeDuration:{type:"string"},description:{type:"string"},repeat:{type:"string"},hasSubscriptionPrice:{type:"number"}}},hasFreePrice:{type:"object",properties:{hasPriceFree:{type:"boolean"}}}}},dataExchangeAgreement:{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},signatures:{type:"object",required:["providerSignature","consumerSignature"],properties:{providerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"},consumerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"}}}}},keyPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]}},required:["dataSharingAgreement"]}},required:["type","resource"]},{title:"NonRepudiationProof",type:"object",properties:{type:{example:"NonRepudiationProof",enum:["NonRepudiationProof"]},name:{type:"string",example:"Resource name"},resource:{description:"a non-repudiation proof (either a PoO, a PoR or a PoP) as a compact JWS"}},required:["type","resource"]},{title:"DataExchangeResource",type:"object",properties:{type:{example:"DataExchange",enum:["DataExchange"]},name:{type:"string",example:"Resource name"},resource:{allOf:[{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},{type:"object",properties:{cipherblockDgst:{type:"string",description:"hash of the cipherblock in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},blockCommitment:{type:"string",description:"hash of the plaintext block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},secretCommitment:{type:"string",description:"ash of the secret that can be used to decrypt the block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"}},required:["cipherblockDgst","blockCommitment","secretCommitment"]}]}},required:["type","resource"]}]}},Resource:{title:"Resource",anyOf:[{title:"VerifiableCredential",type:"object",properties:{type:{example:"VerifiableCredential",enum:["VerifiableCredential"]},name:{type:"string",example:"Resource name"},resource:{type:"object",properties:{"@context":{type:"array",items:{type:"string"},example:["https://www.w3.org/2018/credentials/v1"]},id:{type:"string",example:"http://example.edu/credentials/1872"},type:{type:"array",items:{type:"string"},example:["VerifiableCredential"]},issuer:{type:"object",properties:{id:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},additionalProperties:!0,required:["id"]},issuanceDate:{type:"string",format:"date-time",example:"2021-06-10T19:07:28.000Z"},credentialSubject:{type:"object",properties:{id:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},required:["id"],additionalProperties:!0},proof:{type:"object",properties:{type:{type:"string",enum:["JwtProof2020"]}},required:["type"],additionalProperties:!0}},additionalProperties:!0,required:["@context","type","issuer","issuanceDate","credentialSubject","proof"]}},required:["type","resource"]},{title:"ObjectResource",type:"object",properties:{type:{example:"Object",enum:["Object"]},name:{type:"string",example:"Resource name"},parentResource:{type:"string"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",additionalProperties:!0}},required:["type","resource"]},{title:"JWK pair",type:"object",properties:{type:{example:"KeyPair",enum:["KeyPair"]},name:{type:"string",example:"Resource name"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",properties:{keyPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]}},required:["keyPair"]}},required:["type","resource"]},{title:"Contract",type:"object",properties:{type:{example:"Contract",enum:["Contract"]},name:{type:"string",example:"Resource name"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",properties:{dataSharingAgreement:{type:"object",required:["dataOfferingDescription","parties","purpose","duration","intendedUse","licenseGrant","dataStream","personalData","pricingModel","dataExchangeAgreement","signatures"],properties:{dataOfferingDescription:{type:"object",required:["dataOfferingId","version","active"],properties:{dataOfferingId:{type:"string"},version:{type:"integer"},category:{type:"string"},active:{type:"boolean"},title:{type:"string"}}},parties:{type:"object",required:["providerDid","consumerDid"],properties:{providerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},consumerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}}},purpose:{type:"string"},duration:{type:"object",required:["creationDate","startDate","endDate"],properties:{creationDate:{type:"integer"},startDate:{type:"integer"},endDate:{type:"integer"}}},intendedUse:{type:"object",required:["processData","shareDataWithThirdParty","editData"],properties:{processData:{type:"boolean"},shareDataWithThirdParty:{type:"boolean"},editData:{type:"boolean"}}},licenseGrant:{type:"object",required:["transferable","exclusiveness","paidUp","revocable","processing","modifying","analyzing","storingData","storingCopy","reproducing","distributing","loaning","selling","renting","furtherLicensing","leasing"],properties:{transferable:{type:"boolean"},exclusiveness:{type:"boolean"},paidUp:{type:"boolean"},revocable:{type:"boolean"},processing:{type:"boolean"},modifying:{type:"boolean"},analyzing:{type:"boolean"},storingData:{type:"boolean"},storingCopy:{type:"boolean"},reproducing:{type:"boolean"},distributing:{type:"boolean"},loaning:{type:"boolean"},selling:{type:"boolean"},renting:{type:"boolean"},furtherLicensing:{type:"boolean"},leasing:{type:"boolean"}}},dataStream:{type:"boolean"},personalData:{type:"boolean"},pricingModel:{type:"object",required:["basicPrice","currency","hasFreePrice"],properties:{paymentType:{type:"string"},pricingModelName:{type:"string"},basicPrice:{type:"number",format:"float"},currency:{type:"string"},fee:{type:"number",format:"float"},hasPaymentOnSubscription:{type:"object",properties:{paymentOnSubscriptionName:{type:"string"},paymentType:{type:"string"},timeDuration:{type:"string"},description:{type:"string"},repeat:{type:"string"},hasSubscriptionPrice:{type:"number"}}},hasFreePrice:{type:"object",properties:{hasPriceFree:{type:"boolean"}}}}},dataExchangeAgreement:{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},signatures:{type:"object",required:["providerSignature","consumerSignature"],properties:{providerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"},consumerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"}}}}},keyPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]}},required:["dataSharingAgreement"]}},required:["type","resource"]},{title:"NonRepudiationProof",type:"object",properties:{type:{example:"NonRepudiationProof",enum:["NonRepudiationProof"]},name:{type:"string",example:"Resource name"},resource:{description:"a non-repudiation proof (either a PoO, a PoR or a PoP) as a compact JWS"}},required:["type","resource"]},{title:"DataExchangeResource",type:"object",properties:{type:{example:"DataExchange",enum:["DataExchange"]},name:{type:"string",example:"Resource name"},resource:{allOf:[{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},{type:"object",properties:{cipherblockDgst:{type:"string",description:"hash of the cipherblock in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},blockCommitment:{type:"string",description:"hash of the plaintext block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},secretCommitment:{type:"string",description:"ash of the secret that can be used to decrypt the block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"}},required:["cipherblockDgst","blockCommitment","secretCommitment"]}]}},required:["type","resource"]}]},VerifiableCredential:{title:"VerifiableCredential",type:"object",properties:{type:{example:"VerifiableCredential",enum:["VerifiableCredential"]},name:{type:"string",example:"Resource name"},resource:{type:"object",properties:{"@context":{type:"array",items:{type:"string"},example:["https://www.w3.org/2018/credentials/v1"]},id:{type:"string",example:"http://example.edu/credentials/1872"},type:{type:"array",items:{type:"string"},example:["VerifiableCredential"]},issuer:{type:"object",properties:{id:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},additionalProperties:!0,required:["id"]},issuanceDate:{type:"string",format:"date-time",example:"2021-06-10T19:07:28.000Z"},credentialSubject:{type:"object",properties:{id:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},required:["id"],additionalProperties:!0},proof:{type:"object",properties:{type:{type:"string",enum:["JwtProof2020"]}},required:["type"],additionalProperties:!0}},additionalProperties:!0,required:["@context","type","issuer","issuanceDate","credentialSubject","proof"]}},required:["type","resource"]},ObjectResource:{title:"ObjectResource",type:"object",properties:{type:{example:"Object",enum:["Object"]},name:{type:"string",example:"Resource name"},parentResource:{type:"string"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",additionalProperties:!0}},required:["type","resource"]},KeyPair:{title:"JWK pair",type:"object",properties:{type:{example:"KeyPair",enum:["KeyPair"]},name:{type:"string",example:"Resource name"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",properties:{keyPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]}},required:["keyPair"]}},required:["type","resource"]},Contract:{title:"Contract",type:"object",properties:{type:{example:"Contract",enum:["Contract"]},name:{type:"string",example:"Resource name"},identity:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},resource:{type:"object",properties:{dataSharingAgreement:{type:"object",required:["dataOfferingDescription","parties","purpose","duration","intendedUse","licenseGrant","dataStream","personalData","pricingModel","dataExchangeAgreement","signatures"],properties:{dataOfferingDescription:{type:"object",required:["dataOfferingId","version","active"],properties:{dataOfferingId:{type:"string"},version:{type:"integer"},category:{type:"string"},active:{type:"boolean"},title:{type:"string"}}},parties:{type:"object",required:["providerDid","consumerDid"],properties:{providerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},consumerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}}},purpose:{type:"string"},duration:{type:"object",required:["creationDate","startDate","endDate"],properties:{creationDate:{type:"integer"},startDate:{type:"integer"},endDate:{type:"integer"}}},intendedUse:{type:"object",required:["processData","shareDataWithThirdParty","editData"],properties:{processData:{type:"boolean"},shareDataWithThirdParty:{type:"boolean"},editData:{type:"boolean"}}},licenseGrant:{type:"object",required:["transferable","exclusiveness","paidUp","revocable","processing","modifying","analyzing","storingData","storingCopy","reproducing","distributing","loaning","selling","renting","furtherLicensing","leasing"],properties:{transferable:{type:"boolean"},exclusiveness:{type:"boolean"},paidUp:{type:"boolean"},revocable:{type:"boolean"},processing:{type:"boolean"},modifying:{type:"boolean"},analyzing:{type:"boolean"},storingData:{type:"boolean"},storingCopy:{type:"boolean"},reproducing:{type:"boolean"},distributing:{type:"boolean"},loaning:{type:"boolean"},selling:{type:"boolean"},renting:{type:"boolean"},furtherLicensing:{type:"boolean"},leasing:{type:"boolean"}}},dataStream:{type:"boolean"},personalData:{type:"boolean"},pricingModel:{type:"object",required:["basicPrice","currency","hasFreePrice"],properties:{paymentType:{type:"string"},pricingModelName:{type:"string"},basicPrice:{type:"number",format:"float"},currency:{type:"string"},fee:{type:"number",format:"float"},hasPaymentOnSubscription:{type:"object",properties:{paymentOnSubscriptionName:{type:"string"},paymentType:{type:"string"},timeDuration:{type:"string"},description:{type:"string"},repeat:{type:"string"},hasSubscriptionPrice:{type:"number"}}},hasFreePrice:{type:"object",properties:{hasPriceFree:{type:"boolean"}}}}},dataExchangeAgreement:{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},signatures:{type:"object",required:["providerSignature","consumerSignature"],properties:{providerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"},consumerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"}}}}},keyPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]}},required:["dataSharingAgreement"]}},required:["type","resource"]},DataExchangeResource:{title:"DataExchangeResource",type:"object",properties:{type:{example:"DataExchange",enum:["DataExchange"]},name:{type:"string",example:"Resource name"},resource:{allOf:[{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},{type:"object",properties:{cipherblockDgst:{type:"string",description:"hash of the cipherblock in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},blockCommitment:{type:"string",description:"hash of the plaintext block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},secretCommitment:{type:"string",description:"ash of the secret that can be used to decrypt the block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"}},required:["cipherblockDgst","blockCommitment","secretCommitment"]}]}},required:["type","resource"]},NonRepudiationProof:{title:"NonRepudiationProof",type:"object",properties:{type:{example:"NonRepudiationProof",enum:["NonRepudiationProof"]},name:{type:"string",example:"Resource name"},resource:{description:"a non-repudiation proof (either a PoO, a PoR or a PoP) as a compact JWS"}},required:["type","resource"]},ResourceId:{type:"object",properties:{id:{type:"string"}},required:["id"]},ResourceType:{type:"string",enum:["VerifiableCredential","Object","KeyPair","Contract","DataExchange","NonRepudiationProof"]},SignedTransaction:{title:"SignedTransaction",description:"A list of resources",type:"object",properties:{transaction:{type:"string",pattern:"^0x(?:[A-Fa-f0-9])+$"}}},DecodedJwt:{title:"JwtPayload",type:"object",properties:{header:{type:"object",properties:{typ:{type:"string",enum:["JWT"]},alg:{type:"string",enum:["ES256K"]}},required:["typ","alg"],additionalProperties:!0},payload:{type:"object",properties:{iss:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}},required:["iss"],additionalProperties:!0},signature:{type:"string",format:"^[A-Za-z0-9_-]+$"},data:{type:"string",format:"^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",description:"."}},required:["signature","data"]},VerificationOutput:{title:"VerificationOutput",type:"object",properties:{verification:{type:"string",enum:["success","failed"],description:"whether verification has been successful or has failed"},error:{type:"string",description:"error message if verification failed"},decodedJwt:{description:"the decoded JWT"}},required:["verification"]},ProviderData:{title:"ProviderData",description:"A JSON object with information of the DLT provider currently in use.",type:"object",properties:{provider:{type:"string",example:"did:ethr:i3m"},network:{type:"string",example:"i3m"},rpcUrl:{type:"string",example:"http://95.211.3.250:8545"}},additionalProperties:!0},EthereumAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},did:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},IdentityData:{title:"Identity Data",type:"object",properties:{did:{type:"string",example:"did:ethr:i3m:0x03142f480f831e835822fc0cd35726844a7069d28df58fb82037f1598812e1ade8"},alias:{type:"string",example:"identity1"},provider:{type:"string",example:"did:ethr:i3m"},addresses:{type:"array",items:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},example:["0x8646cAcF516de1292be1D30AB68E7Ea51e9B1BE7"]}},required:["did"]},ApiError:{type:"object",title:"Error",required:["code","message"],properties:{code:{type:"integer",format:"int32"},message:{type:"string"}}},JwkPair:{type:"object",properties:{privateJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n",example:'{"alg":"ES256","crv":"P-256","d":"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'},publicJwk:{type:"string",description:"A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8","y":"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE"}'}},required:["privateJwk","publicJwk"]},CompactJWS:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"},DataExchangeAgreement:{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},DataSharingAgreement:{type:"object",required:["dataOfferingDescription","parties","purpose","duration","intendedUse","licenseGrant","dataStream","personalData","pricingModel","dataExchangeAgreement","signatures"],properties:{dataOfferingDescription:{type:"object",required:["dataOfferingId","version","active"],properties:{dataOfferingId:{type:"string"},version:{type:"integer"},category:{type:"string"},active:{type:"boolean"},title:{type:"string"}}},parties:{type:"object",required:["providerDid","consumerDid"],properties:{providerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"},consumerDid:{description:"a DID using the ethr resolver",type:"string",pattern:"^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$",example:"did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863"}}},purpose:{type:"string"},duration:{type:"object",required:["creationDate","startDate","endDate"],properties:{creationDate:{type:"integer"},startDate:{type:"integer"},endDate:{type:"integer"}}},intendedUse:{type:"object",required:["processData","shareDataWithThirdParty","editData"],properties:{processData:{type:"boolean"},shareDataWithThirdParty:{type:"boolean"},editData:{type:"boolean"}}},licenseGrant:{type:"object",required:["transferable","exclusiveness","paidUp","revocable","processing","modifying","analyzing","storingData","storingCopy","reproducing","distributing","loaning","selling","renting","furtherLicensing","leasing"],properties:{transferable:{type:"boolean"},exclusiveness:{type:"boolean"},paidUp:{type:"boolean"},revocable:{type:"boolean"},processing:{type:"boolean"},modifying:{type:"boolean"},analyzing:{type:"boolean"},storingData:{type:"boolean"},storingCopy:{type:"boolean"},reproducing:{type:"boolean"},distributing:{type:"boolean"},loaning:{type:"boolean"},selling:{type:"boolean"},renting:{type:"boolean"},furtherLicensing:{type:"boolean"},leasing:{type:"boolean"}}},dataStream:{type:"boolean"},personalData:{type:"boolean"},pricingModel:{type:"object",required:["basicPrice","currency","hasFreePrice"],properties:{paymentType:{type:"string"},pricingModelName:{type:"string"},basicPrice:{type:"number",format:"float"},currency:{type:"string"},fee:{type:"number",format:"float"},hasPaymentOnSubscription:{type:"object",properties:{paymentOnSubscriptionName:{type:"string"},paymentType:{type:"string"},timeDuration:{type:"string"},description:{type:"string"},repeat:{type:"string"},hasSubscriptionPrice:{type:"number"}}},hasFreePrice:{type:"object",properties:{hasPriceFree:{type:"boolean"}}}}},dataExchangeAgreement:{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},signatures:{type:"object",required:["providerSignature","consumerSignature"],properties:{providerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"},consumerSignature:{title:"CompactJWS",type:"string",pattern:"^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"}}}}},DataExchange:{allOf:[{type:"object",required:["orig","dest","encAlg","signingAlg","hashAlg","ledgerContractAddress","ledgerSignerAddress","pooToPorDelay","pooToPopDelay","pooToSecretDelay"],properties:{orig:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo","y":"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0"}'},dest:{type:"string",description:"A stringified JWK with alphabetically sorted claims",example:'{"alg":"ES256","crv":"P-256","kty":"EC","x":"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k","y":"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4"}'},encAlg:{type:"string",enum:["A128GCM","A256GCM"],example:"A256GCM"},signingAlg:{type:"string",enum:["ES256","ES384","ES512"],example:"ES256"},hashAlg:{type:"string",enum:["SHA-256","SHA-384","SHA-512"],example:"SHA-256"},ledgerContractAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},ledgerSignerAddress:{description:"Ethereum Address in EIP-55 format (with checksum)",type:"string",pattern:"^0x([0-9A-Fa-f]){40}$",example:"0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},pooToPorDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and verified PoR",type:"integer",minimum:1,example:1e4},pooToPopDelay:{description:"Maximum acceptable time in milliseconds between issued PoO and issued PoP",type:"integer",minimum:1,example:2e4},pooToSecretDelay:{description:"Maximum acceptable time between issued PoO and secret published on the ledger",type:"integer",minimum:1,example:18e4},schema:{description:"A stringified JSON-LD schema describing the data format",type:"string"}}},{type:"object",properties:{cipherblockDgst:{type:"string",description:"hash of the cipherblock in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},blockCommitment:{type:"string",description:"hash of the plaintext block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"},secretCommitment:{type:"string",description:"ash of the secret that can be used to decrypt the block in base64url with no padding",pattern:"^[a-zA-Z0-9_-]+$"}},required:["cipherblockDgst","blockCommitment","secretCommitment"]}]}}},Dp={exports:{}},$p={},Bp={},Fp={},zp={},Up={},Lp={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function i(e,...t){const r=[e[0]];let i=0;for(;i{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(i,o,a={},s){let c=t.nil;for(const u in i){const f=i[u];if(!f)continue;const d=a[u]=a[u]||new Map;f.forEach((i=>{if(d.has(i))return;d.set(i,n.Started);let a=o(i);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${i} = ${a};${this.opts._n}`}else{if(!(a=null==s?void 0:s(i)))throw new r(i);c=t._`${c}${a}${this.opts._n}`}d.set(i,n.Completed)}))}return c}}}(qp),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Lp,r=qp;var n=Lp;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var i=qp;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=C(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class s extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=C(this.rhs,e,r),this}get names(){return M(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends s{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class d extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class l extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=C(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const i=r[n];i.optimizeNames(e,t)||(I(e,i.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>k(e,t.names)),{})}}class p extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class g extends p{}g.kind="else";class y extends p{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(R(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=C(this.condition,e,t),this}get names(){const e=super.names;return M(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class b extends p{}b.kind="for";class v extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=C(this.iteration,e,t),this}get names(){return k(super.names,this.iteration.names)}}class w extends b{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${t} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){const e=M(super.names,this.from);return M(e,this.to)}}class A extends b{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=C(this.iterable,e,t),this}get names(){return k(super.names,this.iterable.names)}}class _ extends p{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}_.kind="func";class E extends h{render(e){return"return "+super.render(e)}}E.kind="return";class S extends p{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&k(e,this.catch.names),this.finally&&k(e,this.finally.names),e}}class P extends p{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class x extends p{render(e){return"finally"+super.render(e)}}x.kind="finally";function k(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function M(e,r){return r instanceof t._CodeOrName?k(e,r.names):e}function C(e,r,n){return e instanceof t.Name?o(e):(i=e)instanceof t._Code&&i._items.some((e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str]))?new t._Code(e._items.reduce(((e,r)=>(r instanceof t.Name&&(r=o(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e)),[])):e;var i;function o(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function I(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${j(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const i=this._scope.toName(t);return void 0!==r&&n&&(this._constants[i.str]=r),this._leafNode(new a(e,i,r)),i}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new s(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new l(e)),this}object(...e){const r=["{"];for(const[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,i));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new v(e),t)}forRange(e,t,n,i,o=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new w(o,a,t,n),(()=>i(a)))}forOf(e,n,i,o=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,(r=>{this.var(a,t._`${e}[${r}]`),i(a)}))}return this._for(new A("of",o,a,n),(()=>i(a)))}forIn(e,n,i,o=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,i);const a=this._scope.toName(e);return this._for(new A("in",o,a,n),(()=>i(a)))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new f(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new S;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new P(e),t(e)}return r&&(this._currNode=n.finally=new x,this.code(r)),this._endBlockNode(P,x)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,i){return this._blockNode(new _(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=R;const N=T(e.operators.AND);e.and=function(...e){return e.reduce(N)};const O=T(e.operators.OR);function T(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${j(r)} ${e} ${j(n)}`}function j(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(O)}}(Up);var Hp={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;const t=Up,r=Lp;function n(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const i=n.RULES.keywords;for(const r in t)i[r]||l(e,`unknown keyword: "${r}"`)}function i(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function o(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:e,mergeToName:r,mergeValues:n,resultToName:i}){return(o,a,s,c)=>{const u=void 0===s?a:s instanceof t.Name?(a instanceof t.Name?e(o,a,s):r(o,a,s),s):a instanceof t.Name?(r(o,s,a),a):n(a,s);return c!==t.Name||u instanceof t.Name?u:i(o,u)}}function c(e,r){if(!0===r)return e.var("props",!0);const n=e.var("props",t._`{}`);return void 0!==r&&u(e,n,r),n}function u(e,r,n){Object.keys(n).forEach((n=>e.assign(t._`${r}${(0,t.getProperty)(n)}`,!0)))}e.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!i(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=i,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:r},n,i,o){if(!o){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return t._`${n}`}return t._`${e}${r}${(0,t.getProperty)(i)}`},e.unescapeFragment=function(e){return a(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(o(e))},e.escapeJsonPointer=o,e.unescapeJsonPointer=a,e.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},e.mergeEvaluated={props:s({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,(()=>{e.if(t._`${r} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,t._`${n} || {}`).code(t._`Object.assign(${n}, ${r})`)))})),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,(()=>{!0===r?e.assign(n,!0):(e.assign(n,t._`${n} || {}`),u(e,n,r))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:c}),items:s({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,(()=>e.assign(n,t._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`))),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,(()=>e.assign(n,!0===r||t._`${n} > ${r} ? ${n} : ${r}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=c,e.setEvaluated=u;const f={};var d;function l(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:f[t.code]||(f[t.code]=new r._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d=e.Type||(e.Type={})),e.getErrorPath=function(e,r,n){if(e instanceof t.Name){const i=r===d.Num;return n?i?t._`"[" + ${e} + "]"`:t._`"['" + ${e} + "']"`:i?t._`"/" + ${e}`:t._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,t.getProperty)(e).toString():"/"+o(e)},e.checkStrictMode=l}(Hp);var Kp={};Object.defineProperty(Kp,"__esModule",{value:!0});const Jp=Up,Wp={data:new Jp.Name("data"),valCxt:new Jp.Name("valCxt"),instancePath:new Jp.Name("instancePath"),parentData:new Jp.Name("parentData"),parentDataProperty:new Jp.Name("parentDataProperty"),rootData:new Jp.Name("rootData"),dynamicAnchors:new Jp.Name("dynamicAnchors"),vErrors:new Jp.Name("vErrors"),errors:new Jp.Name("errors"),this:new Jp.Name("this"),self:new Jp.Name("self"),scope:new Jp.Name("scope"),json:new Jp.Name("json"),jsonPos:new Jp.Name("jsonPos"),jsonLen:new Jp.Name("jsonLen"),jsonPart:new Jp.Name("jsonPart")};Kp.default=Wp,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=Up,r=Hp,n=Kp;function i(e,r){const i=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,t._`[${i}]`)),t._`${n.default.vErrors}.push(${i})`),e.code(t._`${n.default.errors}++`)}function o(e,r){const{gen:n,validateName:i,schemaEnv:o}=e;o.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${i}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,a,c){const{it:u}=r,{gen:f,compositeRule:d,allErrors:l}=u,h=s(r,n,a);(null!=c?c:d||l)?i(f,h):o(u,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:u,compositeRule:f,allErrors:d}=c;i(u,s(t,r,a)),f||d||o(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,(()=>e.if(r,(()=>e.assign(t._`${n.default.vErrors}.length`,r)),(()=>e.assign(n.default.vErrors,null)))))},e.extendErrors=function({gen:e,keyword:r,schemaValue:i,data:o,errsCount:a,it:s}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,(a=>{e.const(c,t._`${n.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,(()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,s.errorPath)))),e.assign(t._`${c}.schemaPath`,t.str`${s.errSchemaPath}/${r}`),s.opts.verbose&&(e.assign(t._`${c}.schema`,i),e.assign(t._`${c}.data`,o))}))};const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function s(e,r,i){const{createErrors:o}=e.it;return!1===o?t._`{}`:function(e,r,i={}){const{gen:o,it:s}=e,f=[c(s,i),u(e,i)];return function(e,{params:r,message:i},o){const{keyword:s,data:c,schemaValue:u,it:f}=e,{opts:d,propertyName:l,topSchemaRef:h,schemaPath:p}=f;o.push([a.keyword,s],[a.params,"function"==typeof r?r(e):r||t._`{}`]),d.messages&&o.push([a.message,"function"==typeof i?i(e):i]);d.verbose&&o.push([a.schema,u],[a.parentSchema,t._`${h}${p}`],[n.default.data,c]);l&&o.push([a.propertyName,l])}(e,r,f),o.object(...f)}(e,r,i)}function c({errorPath:e},{instancePath:i}){const o=i?t.str`${e}${(0,r.getErrorPath)(i,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,o)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:i,parentSchema:o}){let s=o?n:t.str`${n}/${e}`;return i&&(s=t.str`${s}${(0,r.getErrorPath)(i,r.Type.Str)}`),[a.schemaPath,s]}}(zp),Object.defineProperty(Fp,"__esModule",{value:!0}),Fp.boolOrEmptySchema=Fp.topBoolOrEmptySchema=void 0;const Gp=zp,Vp=Up,Zp=Kp,Xp={message:"boolean schema is false"};function Qp(e,t){const{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Gp.reportError)(i,Xp,void 0,t)}Fp.topBoolOrEmptySchema=function(e){const{gen:t,schema:r,validateName:n}=e;!1===r?Qp(e,!1):"object"==typeof r&&!0===r.$async?t.return(Zp.default.data):(t.assign(Vp._`${n}.errors`,null),t.return(!0))},Fp.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),Qp(e)):r.var(t,!0)};var Yp={},em={};Object.defineProperty(em,"__esModule",{value:!0}),em.getRules=em.isJSONType=void 0;const tm=new Set(["string","number","integer","boolean","null","object","array"]);em.isJSONType=function(e){return"string"==typeof e&&tm.has(e)},em.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}};var rm={};function nm(e,t){return t.rules.some((t=>im(e,t)))}function im(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}Object.defineProperty(rm,"__esModule",{value:!0}),rm.shouldUseRule=rm.shouldUseGroup=rm.schemaHasRulesForType=void 0,rm.schemaHasRulesForType=function({schema:e,self:t},r){const n=t.RULES.types[r];return n&&!0!==n&&nm(e,n)},rm.shouldUseGroup=nm,rm.shouldUseRule=im,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=em,r=rm,n=zp,i=Up,o=Hp;var a;function s(e){const r=Array.isArray(e)?e:e?[e]:[];if(r.every(t.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(a=e.DataType||(e.DataType={})),e.getSchemaTypes=function(e){const t=s(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=s,e.coerceAndCheckDataType=function(e,t){const{gen:n,data:o,opts:s}=e,u=function(e,t){return t?e.filter((e=>c.has(e)||"array"===t&&"array"===e)):[]}(t,s.coerceTypes),d=t.length>0&&!(0===u.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(d){const r=f(t,o,s.strictNumbers,a.Wrong);n.if(r,(()=>{u.length?function(e,t,r){const{gen:n,data:o,opts:a}=e,s=n.let("dataType",i._`typeof ${o}`),u=n.let("coerced",i._`undefined`);"array"===a.coerceTypes&&n.if(i._`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>n.assign(o,i._`${o}[0]`).assign(s,i._`typeof ${o}`).if(f(t,o,a.strictNumbers),(()=>n.assign(u,o)))));n.if(i._`${u} !== undefined`);for(const e of r)(c.has(e)||"array"===e&&"array"===a.coerceTypes)&&d(e);function d(e){switch(e){case"string":return void n.elseIf(i._`${s} == "number" || ${s} == "boolean"`).assign(u,i._`"" + ${o}`).elseIf(i._`${o} === null`).assign(u,i._`""`);case"number":return void n.elseIf(i._`${s} == "boolean" || ${o} === null || (${s} == "string" && ${o} && ${o} == +${o})`).assign(u,i._`+${o}`);case"integer":return void n.elseIf(i._`${s} === "boolean" || ${o} === null || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(u,i._`+${o}`);case"boolean":return void n.elseIf(i._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(u,!1).elseIf(i._`${o} === "true" || ${o} === 1`).assign(u,!0);case"null":return n.elseIf(i._`${o} === "" || ${o} === 0 || ${o} === false`),void n.assign(u,null);case"array":n.elseIf(i._`${s} === "string" || ${s} === "number" || ${s} === "boolean" || ${o} === null`).assign(u,i._`[${o}]`)}}n.else(),l(e),n.endIf(),n.if(i._`${u} !== undefined`,(()=>{n.assign(o,u),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(i._`${t} !== undefined`,(()=>e.assign(i._`${t}[${r}]`,n)))}(e,u)}))}(e,t,u):l(e)}))}return d};const c=new Set(["string","number","integer","boolean","null"]);function u(e,t,r,n=a.Correct){const o=n===a.Correct?i.operators.EQ:i.operators.NEQ;let s;switch(e){case"null":return i._`${t} ${o} null`;case"array":s=i._`Array.isArray(${t})`;break;case"object":s=i._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=c(i._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=c();break;default:return i._`typeof ${t} ${o} ${e}`}return n===a.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)(i._`typeof ${t} == "number"`,e,r?i._`isFinite(${t})`:i.nil)}}function f(e,t,r,n){if(1===e.length)return u(e[0],t,r,n);let a;const s=(0,o.toHash)(e);if(s.array&&s.object){const e=i._`typeof ${t} != "object"`;a=s.null?e:i._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else a=i.nil;s.number&&delete s.integer;for(const e in s)a=(0,i.and)(a,u(e,t,r,n));return a}e.checkDataType=u,e.checkDataTypes=f;const d={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?i._`{type: ${e}}`:i._`{type: ${t}}`};function l(e){const t=function(e){const{gen:t,data:r,schema:n}=e,i=(0,o.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}(e);(0,n.reportError)(t,d)}e.reportTypeError=l}(Yp);var om={};Object.defineProperty(om,"__esModule",{value:!0}),om.assignDefaults=void 0;const am=Up,sm=Hp;function cm(e,t,r){const{gen:n,compositeRule:i,data:o,opts:a}=e;if(void 0===r)return;const s=am._`${o}${(0,am.getProperty)(t)}`;if(i)return void(0,sm.checkStrictMode)(e,`default is ignored for: ${s}`);let c=am._`${s} === undefined`;"empty"===a.useDefaults&&(c=am._`${c} || ${s} === null || ${s} === ""`),n.if(c,am._`${s} = ${(0,am.stringify)(r)}`)}om.assignDefaults=function(e,t){const{properties:r,items:n}=e.schema;if("object"===t&&r)for(const t in r)cm(e,t,r[t].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,r)=>cm(e,r,t.default)))};var um={},fm={};Object.defineProperty(fm,"__esModule",{value:!0}),fm.validateUnion=fm.validateArray=fm.usePattern=fm.callValidateCode=fm.schemaProperties=fm.allSchemaProperties=fm.noPropertyInData=fm.propertyInData=fm.isOwnProperty=fm.hasPropFunc=fm.reportMissingProp=fm.checkMissingProp=fm.checkReportMissingProp=void 0;const dm=Up,lm=Hp,hm=Kp,pm=Hp;function mm(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:dm._`Object.prototype.hasOwnProperty`})}function gm(e,t,r){return dm._`${mm(e)}.call(${t}, ${r})`}function ym(e,t,r,n){const i=dm._`${t}${(0,dm.getProperty)(r)} === undefined`;return n?(0,dm.or)(i,(0,dm.not)(gm(e,t,r))):i}function bm(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}fm.checkReportMissingProp=function(e,t){const{gen:r,data:n,it:i}=e;r.if(ym(r,n,t,i.opts.ownProperties),(()=>{e.setParams({missingProperty:dm._`${t}`},!0),e.error()}))},fm.checkMissingProp=function({gen:e,data:t,it:{opts:r}},n,i){return(0,dm.or)(...n.map((n=>(0,dm.and)(ym(e,t,n,r.ownProperties),dm._`${i} = ${n}`))))},fm.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},fm.hasPropFunc=mm,fm.isOwnProperty=gm,fm.propertyInData=function(e,t,r,n){const i=dm._`${t}${(0,dm.getProperty)(r)} !== undefined`;return n?dm._`${i} && ${gm(e,t,r)}`:i},fm.noPropertyInData=ym,fm.allSchemaProperties=bm,fm.schemaProperties=function(e,t){return bm(t).filter((r=>!(0,lm.alwaysValidSchema)(e,t[r])))},fm.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:a},s,c,u){const f=u?dm._`${e}, ${t}, ${n}${i}`:t,d=[[hm.default.instancePath,(0,dm.strConcat)(hm.default.instancePath,o)],[hm.default.parentData,a.parentData],[hm.default.parentDataProperty,a.parentDataProperty],[hm.default.rootData,hm.default.rootData]];a.opts.dynamicRef&&d.push([hm.default.dynamicAnchors,hm.default.dynamicAnchors]);const l=dm._`${f}, ${r.object(...d)}`;return c!==dm.nil?dm._`${s}.call(${c}, ${l})`:dm._`${s}(${l})`};const vm=dm._`new RegExp`;fm.usePattern=function({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,o=i(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:dm._`${"new RegExp"===i.code?vm:(0,pm.useFunc)(e,i)}(${r}, ${n})`})},fm.validateArray=function(e){const{gen:t,data:r,keyword:n,it:i}=e,o=t.name("valid");if(i.allErrors){const e=t.let("valid",!0);return a((()=>t.assign(e,!1))),e}return t.var(o,!0),a((()=>t.break())),o;function a(i){const a=t.const("len",dm._`${r}.length`);t.forRange("i",0,a,(r=>{e.subschema({keyword:n,dataProp:r,dataPropType:lm.Type.Num},o),t.if((0,dm.not)(o),i)}))}},fm.validateUnion=function(e){const{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((e=>(0,lm.alwaysValidSchema)(i,e)))&&!i.opts.unevaluated)return;const o=t.let("valid",!1),a=t.name("_valid");t.block((()=>r.forEach(((r,i)=>{const s=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},a);t.assign(o,dm._`${o} || ${a}`);e.mergeValidEvaluated(s,a)||t.if((0,dm.not)(o))})))),e.result(o,(()=>e.reset()),(()=>e.error(!0)))},Object.defineProperty(um,"__esModule",{value:!0}),um.validateKeywordUsage=um.validSchemaType=um.funcKeywordCode=um.macroKeywordCode=void 0;const wm=Up,Am=Kp,_m=fm,Em=zp;function Sm(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,(()=>t.assign(r,wm._`${n.parentData}[${n.parentDataProperty}]`)))}function Pm(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,wm.stringify)(r)})}um.macroKeywordCode=function(e,t){const{gen:r,keyword:n,schema:i,parentSchema:o,it:a}=e,s=t.macro.call(a.self,i,o,a),c=Pm(r,n,s);!1!==a.opts.validateSchema&&a.self.validateSchema(s,!0);const u=r.name("valid");e.subschema({schema:s,schemaPath:wm.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,(()=>e.error(!0)))},um.funcKeywordCode=function(e,t){var r;const{gen:n,keyword:i,schema:o,parentSchema:a,$data:s,it:c}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(c,t);const u=!s&&t.compile?t.compile.call(c.self,o,a,c):t.validate,f=Pm(n,i,u),d=n.let("valid");function l(r=(t.async?wm._`await `:wm.nil)){const i=c.opts.passContext?Am.default.this:Am.default.self,o=!("compile"in t&&!s||!1===t.schema);n.assign(d,wm._`${r}${(0,_m.callValidateCode)(e,f,i,o)}`,t.modifying)}function h(e){var r;n.if((0,wm.not)(null!==(r=t.valid)&&void 0!==r?r:d),e)}e.block$data(d,(function(){if(!1===t.errors)l(),t.modifying&&Sm(e),h((()=>e.error()));else{const r=t.async?function(){const e=n.let("ruleErrs",null);return n.try((()=>l(wm._`await `)),(t=>n.assign(d,!1).if(wm._`${t} instanceof ${c.ValidationError}`,(()=>n.assign(e,wm._`${t}.errors`)),(()=>n.throw(t))))),e}():function(){const e=wm._`${f}.errors`;return n.assign(e,null),l(wm.nil),e}();t.modifying&&Sm(e),h((()=>function(e,t){const{gen:r}=e;r.if(wm._`Array.isArray(${t})`,(()=>{r.assign(Am.default.vErrors,wm._`${Am.default.vErrors} === null ? ${t} : ${Am.default.vErrors}.concat(${t})`).assign(Am.default.errors,wm._`${Am.default.vErrors}.length`),(0,Em.extendErrors)(e)}),(()=>e.error()))}(e,r)))}})),e.ok(null!==(r=t.valid)&&void 0!==r?r:d)},um.validSchemaType=function(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e))},um.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");const a=i.dependencies;if(null==a?void 0:a.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(i.validateSchema){if(!i.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}};var xm={};Object.defineProperty(xm,"__esModule",{value:!0}),xm.extendSubschemaMode=xm.extendSubschemaData=xm.getSubschema=void 0;const km=Up,Mm=Hp;xm.getSubschema=function(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:a}){if(void 0!==t&&void 0!==n)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const n=e.schema[t];return void 0===r?{schema:n,schemaPath:km._`${e.schemaPath}${(0,km.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:n[r],schemaPath:km._`${e.schemaPath}${(0,km.getProperty)(t)}${(0,km.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Mm.escapeFragment)(r)}`}}if(void 0!==n){if(void 0===i||void 0===o||void 0===a)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')},xm.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:a}){if(void 0!==i&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:s}=t;if(void 0!==r){const{errorPath:i,dataPathArr:o,opts:a}=t;c(s.let("data",km._`${t.data}${(0,km.getProperty)(r)}`,!0)),e.errorPath=km.str`${i}${(0,Mm.getErrorPath)(r,n,a.jsPropertySyntax)}`,e.parentDataProperty=km._`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}if(void 0!==i){c(i instanceof km.Name?i:s.let("data",i,!0)),void 0!==a&&(e.propertyName=a)}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}o&&(e.dataTypes=o)},xm.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(e.compositeRule=n),void 0!==i&&(e.createErrors=i),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r};var Cm={},Im=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},Rm={exports:{}},Nm=Rm.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),Om(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function Om(e,t,r,n,i,o,a,s,c,u){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var f in t(n,i,o,a,s,c,u),n){var d=n[f];if(Array.isArray(d)){if(f in Nm.arrayKeywords)for(var l=0;lt+=Um(e))),t===1/0))return 1/0}return t}function Lm(e,t="",r){!1!==r&&(t=Km(t));const n=e.parse(t);return qm(e,n)}function qm(e,t){return e.serialize(t).split("#")[0]+"#"}Cm.getFullPath=Lm,Cm._getFullPath=qm;const Hm=/#\/?$/;function Km(e){return e?e.replace(Hm,""):""}Cm.normalizeId=Km,Cm.resolveUrl=function(e,t,r){return r=Km(r),e.resolve(t,r)};const Jm=/^[a-z_][-a-z0-9._]*$/i;Cm.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,i=Km(e[r]||t),o={"":i},a=Lm(n,i,!1),s={},c=new Set;return $m(e,{allKeys:!0},((e,t,n,i)=>{if(void 0===i)return;const d=a+t;let l=o[i];function h(t){const r=this.opts.uriResolver.resolve;if(t=Km(l?r(l,t):t),c.has(t))throw f(t);c.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?u(e,n.schema,t):t!==Km(d)&&("#"===t[0]?(u(e,s[t],t),s[t]=e):this.refs[t]=d),t}function p(e){if("string"==typeof e){if(!Jm.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[r]&&(l=h.call(this,e[r])),p.call(this,e.$anchor),p.call(this,e.$dynamicAnchor),o[t]=l})),s;function u(e,t,r){if(void 0!==t&&!Dm(e,t))throw f(r)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Object.defineProperty(Bp,"__esModule",{value:!0}),Bp.getData=Bp.KeywordCxt=Bp.validateFunctionCode=void 0;const Wm=Fp,Gm=Yp,Vm=rm,Zm=Yp,Xm=om,Qm=um,Ym=xm,eg=Up,tg=Kp,rg=Cm,ng=Hp,ig=zp;function og({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,eg._`${tg.default.data}, ${tg.default.valCxt}`,n.$async,(()=>{e.code(eg._`"use strict"; ${ag(r,i)}`),function(e,t){e.if(tg.default.valCxt,(()=>{e.var(tg.default.instancePath,eg._`${tg.default.valCxt}.${tg.default.instancePath}`),e.var(tg.default.parentData,eg._`${tg.default.valCxt}.${tg.default.parentData}`),e.var(tg.default.parentDataProperty,eg._`${tg.default.valCxt}.${tg.default.parentDataProperty}`),e.var(tg.default.rootData,eg._`${tg.default.valCxt}.${tg.default.rootData}`),t.dynamicRef&&e.var(tg.default.dynamicAnchors,eg._`${tg.default.valCxt}.${tg.default.dynamicAnchors}`)}),(()=>{e.var(tg.default.instancePath,eg._`""`),e.var(tg.default.parentData,eg._`undefined`),e.var(tg.default.parentDataProperty,eg._`undefined`),e.var(tg.default.rootData,tg.default.data),t.dynamicRef&&e.var(tg.default.dynamicAnchors,eg._`{}`)}))}(e,i),e.code(o)})):e.func(t,eg._`${tg.default.data}, ${function(e){return eg._`{${tg.default.instancePath}="", ${tg.default.parentData}, ${tg.default.parentDataProperty}, ${tg.default.rootData}=${tg.default.data}${e.dynamicRef?eg._`, ${tg.default.dynamicAnchors}={}`:eg.nil}}={}`}(i)}`,n.$async,(()=>e.code(ag(r,i)).code(o)))}function ag(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?eg._`/*# sourceURL=${r} */`:eg.nil}function sg(e,t){ug(e)&&(fg(e),cg(e))?function(e,t){const{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&lg(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rg.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=n.const("_errs",tg.default.errors);dg(e,o),n.var(t,eg._`${o} === ${tg.default.errors}`)}(e,t):(0,Wm.boolOrEmptySchema)(e,t)}function cg({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function ug(e){return"boolean"!=typeof e.schema}function fg(e){(0,ng.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,ng.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function dg(e,t){if(e.opts.jtd)return hg(e,[],!1,t);const r=(0,Gm.getSchemaTypes)(e.schema);hg(e,r,!(0,Gm.coerceAndCheckDataType)(e,r),t)}function lg({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){const o=r.$comment;if(!0===i.$comment)e.code(eg._`${tg.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){const r=eg.str`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(eg._`${tg.default.self}.opts.$comment(${o}, ${r}, ${i}.schema)`)}}function hg(e,t,r,n){const{gen:i,schema:o,data:a,allErrors:s,opts:c,self:u}=e,{RULES:f}=u;function d(u){(0,Vm.shouldUseGroup)(o,u)&&(u.type?(i.if((0,Zm.checkDataType)(u.type,a,c.strictNumbers)),pg(e,u),1===t.length&&t[0]===u.type&&r&&(i.else(),(0,Zm.reportTypeError)(e)),i.endIf()):pg(e,u),s||i.if(eg._`${tg.default.errors} === ${n||0}`))}!o.$ref||!c.ignoreKeywordsWithRef&&(0,ng.schemaHasRulesButRef)(o,f)?(c.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{gg(e.dataTypes,t)||yg(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const r=[];for(const n of e.dataTypes)gg(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&yg(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const r=e.self.RULES.all;for(const n in r){const i=r[n];if("object"==typeof i&&(0,Vm.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some((e=>mg(t,e)))&&yg(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes)}(e,t),i.block((()=>{for(const e of f.rules)d(e);d(f.post)}))):i.block((()=>vg(e,"$ref",f.all.$ref.definition)))}function pg(e,t){const{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,Xm.assignDefaults)(e,t.type),r.block((()=>{for(const r of t.rules)(0,Vm.shouldUseRule)(n,r)&&vg(e,r.keyword,r.definition,t.type)}))}function mg(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function gg(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function yg(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,ng.checkStrictMode)(e,t,e.opts.strictTypes)}Bp.validateFunctionCode=function(e){ug(e)&&(fg(e),cg(e))?function(e){const{schema:t,opts:r,gen:n}=e;og(e,(()=>{r.$comment&&t.$comment&&lg(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,ng.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(tg.default.vErrors,null),n.let(tg.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",eg._`${r}.evaluated`),t.if(eg._`${e.evaluated}.dynamicProps`,(()=>t.assign(eg._`${e.evaluated}.props`,eg._`undefined`))),t.if(eg._`${e.evaluated}.dynamicItems`,(()=>t.assign(eg._`${e.evaluated}.items`,eg._`undefined`)))}(e),dg(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if(eg._`${tg.default.errors} === 0`,(()=>t.return(tg.default.data)),(()=>t.throw(eg._`new ${i}(${tg.default.vErrors})`))):(t.assign(eg._`${n}.errors`,tg.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof eg.Name&&e.assign(eg._`${t}.props`,r);n instanceof eg.Name&&e.assign(eg._`${t}.items`,n)}(e),t.return(eg._`${tg.default.errors} === 0`))}(e)}))}(e):og(e,(()=>(0,Wm.topBoolOrEmptySchema)(e)))};class bg{constructor(e,t,r){if((0,Qm.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ng.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",_g(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Qm.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",tg.default.errors))}result(e,t,r){this.failResult((0,eg.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,eg.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(eg._`${t} !== undefined && (${(0,eg.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?ig.reportExtraError:ig.reportError)(this,this.def.error,t)}$dataError(){(0,ig.reportError)(this,this.def.$dataError||ig.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,ig.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=eg.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=eg.nil,t=eg.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:i,def:o}=this;r.if((0,eg.or)(eg._`${n} === undefined`,t)),e!==eg.nil&&r.assign(e,!0),(i.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==eg.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:i}=this;return(0,eg.or)(function(){if(r.length){if(!(t instanceof eg.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return eg._`${(0,Zm.checkDataTypes)(e,t,i.opts.strictNumbers,Zm.DataType.Wrong)}`}return eg.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return eg._`!${r}(${t})`}return eg.nil}())}subschema(e,t){const r=(0,Ym.getSubschema)(this.it,e);(0,Ym.extendSubschemaData)(r,this.it,e),(0,Ym.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return sg(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=ng.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=ng.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,eg.Name))),!0}}function vg(e,t,r,n){const i=new bg(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Qm.funcKeywordCode)(i,r):"macro"in r?(0,Qm.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Qm.funcKeywordCode)(i,r)}Bp.KeywordCxt=bg;const wg=/^\/(?:[^~]|~0|~1)*$/,Ag=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function _g(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(""===e)return tg.default.rootData;if("/"===e[0]){if(!wg.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=tg.default.rootData}else{const a=Ag.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const s=+a[1];if(i=a[2],"#"===i){if(s>=t)throw new Error(c("property/index",s));return n[t-s]}if(s>t)throw new Error(c("data",s));if(o=r[t-s],!i)return o}let a=o;const s=i.split("/");for(const e of s)e&&(o=eg._`${o}${(0,eg.getProperty)((0,ng.unescapeJsonPointer)(e))}`,a=eg._`${a} && ${o}`);return a;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}Bp.getData=_g;var Eg={};Object.defineProperty(Eg,"__esModule",{value:!0});class Sg extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}Eg.default=Sg;var Pg={};Object.defineProperty(Pg,"__esModule",{value:!0});const xg=Cm;class kg extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,xg.resolveUrl)(e,t,r),this.missingSchema=(0,xg.normalizeId)((0,xg.getFullPath)(e,this.missingRef))}}Pg.default=kg;var Mg={};Object.defineProperty(Mg,"__esModule",{value:!0}),Mg.resolveSchema=Mg.getCompilingSchema=Mg.resolveRef=Mg.compileSchema=Mg.SchemaEnv=void 0;const Cg=Up,Ig=Eg,Rg=Kp,Ng=Cm,Og=Hp,Tg=Bp;class jg{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,Ng.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function Dg(e){const t=Bg.call(this,e);if(t)return t;const r=(0,Ng.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,a=new Cg.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o});let s;e.$async&&(s=a.scopeValue("Error",{ref:Ig.default,code:Cg._`require("ajv/dist/runtime/validation_error").default`}));const c=a.scopeName("validate");e.validateName=c;const u={gen:a,allErrors:this.opts.allErrors,data:Rg.default.data,parentData:Rg.default.parentData,parentDataProperty:Rg.default.parentDataProperty,dataNames:[Rg.default.data],dataPathArr:[Cg.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,Cg.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Cg.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Cg._`""`,opts:this.opts,self:this};let f;try{this._compilations.add(e),(0,Tg.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);const t=a.toString();f=`${a.scopeRefs(Rg.default.scope)}return ${t}`,this.opts.code.process&&(f=this.opts.code.process(f,e));const r=new Function(`${Rg.default.self}`,`${Rg.default.scope}`,f)(this,this.scope.get());if(this.scope.value(c,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:c,validateCode:t,scopeValues:a._values}),this.opts.unevaluated){const{props:e,items:t}=u;r.evaluated={props:e instanceof Cg.Name?void 0:e,items:t instanceof Cg.Name?void 0:t,dynamicProps:e instanceof Cg.Name,dynamicItems:t instanceof Cg.Name},r.source&&(r.source.evaluated=(0,Cg.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,f&&this.logger.error("Error compiling schema, function code:",f),t}finally{this._compilations.delete(e)}}function $g(e){return(0,Ng.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Dg.call(this,e)}function Bg(e){for(const n of this._compilations)if(r=e,(t=n).schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return n;var t,r}function Fg(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||zg.call(this,e,t)}function zg(e,t){const r=this.opts.uriResolver.parse(t),n=(0,Ng._getFullPath)(this.opts.uriResolver,r);let i=(0,Ng.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return Lg.call(this,r,e);const o=(0,Ng.normalizeId)(n),a=this.refs[o]||this.schemas[o];if("string"==typeof a){const t=zg.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return Lg.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||Dg.call(this,a),o===(0,Ng.normalizeId)(t)){const{schema:t}=a,{schemaId:r}=this.opts,n=t[r];return n&&(i=(0,Ng.resolveUrl)(this.opts.uriResolver,i,n)),new jg({schema:t,schemaId:r,root:e,baseId:i})}return Lg.call(this,r,a)}}Mg.SchemaEnv=jg,Mg.compileSchema=Dg,Mg.resolveRef=function(e,t,r){var n;r=(0,Ng.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let o=Fg.call(this,e,r);if(void 0===o){const i=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new jg({schema:i,schemaId:a,root:e,baseId:t}))}return void 0!==o?e.refs[r]=$g.call(this,o):void 0},Mg.getCompilingSchema=Bg,Mg.resolveSchema=zg;const Ug=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Lg(e,{baseId:t,schema:r,root:n}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,Og.unescapeFragment)(n)];if(void 0===e)return;const i="object"==typeof(r=e)&&r[this.opts.schemaId];!Ug.has(n)&&i&&(t=(0,Ng.resolveUrl)(this.opts.uriResolver,t,i))}let o;if("boolean"!=typeof r&&r.$ref&&!(0,Og.schemaHasRulesButRef)(r,this.RULES)){const e=(0,Ng.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=zg.call(this,n,e)}const{schemaId:a}=this.opts;return o=o||new jg({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema?o:void 0}var qg={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},Hg={},Kg={exports:{}}; /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ !function(e,t){!function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,i=1;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=h-p,x=Math.floor,k=String.fromCharCode;function M(e){throw new RangeError(S[e])}function C(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}function I(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+C((e=e.replace(E,".")).split("."),t).join(".")}function R(e){for(var t=[],r=0,n=e.length;r=55296&&i<=56319&&r>1,e+=x(e/t);e>P*m>>1;n+=h)e=x(e/P);return x(n+(P+1)*e/(e+g))},j=function(e){var t=[],r=e.length,n=0,i=v,o=b,a=e.lastIndexOf(w);a<0&&(a=0);for(var s=0;s=128&&M("not-basic"),t.push(e.charCodeAt(s));for(var c=a>0?a+1:0;c=r&&M("invalid-input");var g=N(e.charCodeAt(c++));(g>=h||g>x((l-n)/f))&&M("overflow"),n+=g*f;var y=d<=o?p:d>=o+m?m:d-o;if(gx(l/A)&&M("overflow"),f*=A}var _=t.length+1;o=T(n-u,_,0==u),x(n/_)>l-i&&M("overflow"),i+=x(n/_),n%=_,t.splice(n++,0,i)}return String.fromCodePoint.apply(String,t)},D=function(e){var t=[],r=(e=R(e)).length,n=v,i=0,o=b,a=!0,s=!1,c=void 0;try{for(var u,f=e[Symbol.iterator]();!(a=(u=f.next()).done);a=!0){var d=u.value;d<128&&t.push(k(d))}}catch(e){s=!0,c=e}finally{try{!a&&f.return&&f.return()}finally{if(s)throw c}}var g=t.length,y=g;for(g&&t.push(w);y=n&&Ix((l-i)/N)&&M("overflow"),i+=(A-n)*N,n=A;var j=!0,D=!1,$=void 0;try{for(var B,F=e[Symbol.iterator]();!(j=(B=F.next()).done);j=!0){var z=B.value;if(zl&&M("overflow"),z==n){for(var U=i,L=h;;L+=h){var q=L<=o?p:L>=o+m?m:L-o;if(U>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function L(e){for(var t="",r=0,n=e.length;r=194&&i<224){if(n-r>=6){var o=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&i)<<6|63&o)}else t+=e.substr(r,6);r+=6}else if(i>=224){if(n-r>=9){var a=parseInt(e.substr(r+4,2),16),s=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&i)<<12|(63&a)<<6|63&s)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function q(e,t){function r(e){var r=L(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,U).replace(t.PCT_ENCODED,i)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,U).replace(t.PCT_ENCODED,i)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,U).replace(t.PCT_ENCODED,i)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,U).replace(t.PCT_ENCODED,i)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,U).replace(t.PCT_ENCODED,i)),e}function H(e){return e.replace(/^0*(.*)/,"$1")||"0"}function K(e,t){var r=e.match(t.IPV4ADDRESS)||[],n=f(r,2)[1];return n?n.split(".").map(H).join("."):e}function J(e,t){var r=e.match(t.IPV6ADDRESS)||[],n=f(r,3),i=n[1],o=n[2];if(i){for(var a=i.toLowerCase().split("::").reverse(),s=f(a,2),c=s[0],u=s[1],d=u?u.split(":").map(H):[],l=c.split(":").map(H),h=t.IPV4ADDRESS.test(l[l.length-1]),p=h?7:8,m=l.length-p,g=Array(p),y=0;y1){var A=g.slice(0,v.index),_=g.slice(v.index+v.length);w=A.join(":")+"::"+_.join(":")}else w=g.join(":");return o&&(w+="%"+o),w}return e}var W=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,G=void 0==="".match(/(){0}/)[1];function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?u:c;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var i=e.match(W);if(i){G?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==e.indexOf("@")?i[3]:void 0,r.host=-1!==e.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==e.indexOf("?")?i[7]:void 0,r.fragment=-1!==e.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=J(K(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var o=z[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)q(r,n);else{if(r.host&&(t.domainHost||o&&o.domainHost))try{r.host=F.toASCII(r.host.replace(n.PCT_ENCODED,L).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}q(r,c)}o&&o.parse&&o.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function Z(e,t){var r=!1!==t.iri?u:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(J(K(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var X=/^\.\.?\//,Q=/^\/\.(\/|$)/,Y=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(X))e=e.replace(X,"");else if(e.match(Q))e=e.replace(Q,"/");else if(e.match(Y))e=e.replace(Y,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(ee);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?u:c,n=[],i=z[(t.scheme||e.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||i&&i.domainHost)try{e.host=t.iri?F.toUnicode(e.host):F.toASCII(e.host.replace(r.PCT_ENCODED,L).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}q(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var o=Z(e,t);if(void 0!==o&&("suffix"!==t.reference&&n.push("//"),n.push(o),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var a=e.path;t.absolutePath||i&&i.absolutePath||(a=te(a)),void 0===o&&(a=a.replace(/^\/\//,"/%2F")),n.push(a)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=V(re(e,r),r),t=V(re(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=te(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=te(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=te(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function ie(e,t,r){var n=a({scheme:"null"},r);return re(ne(V(e,n),V(t,n),n,!0),n)}function oe(e,t){return"string"==typeof e?e=re(V(e,t),t):"object"===n(e)&&(e=V(re(e,t),t)),e}function ae(e,t,r){return"string"==typeof e?e=re(V(e,r),r):"object"===n(e)&&(e=re(e,r)),"string"==typeof t?t=re(V(t,r),r):"object"===n(t)&&(t=re(t,r)),e===t}function se(e,t){return e&&e.toString().replace(t&&t.iri?u.ESCAPE:c.ESCAPE,U)}function ce(e,t){return e&&e.toString().replace(t&&t.iri?u.PCT_ENCODED:c.PCT_ENCODED,L)}var ue={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},fe={scheme:"https",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize};function de(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var le={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=de(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(de(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),n=f(r,2),i=n[0],o=n[1];e.path=i&&"/"!==i?i:void 0,e.query=o,e.resourceName=void 0}return e.fragment=void 0,e}},he={scheme:"wss",domainHost:le.domainHost,parse:le.parse,serialize:le.serialize},pe={},me="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ye=r(r("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+r("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+r("%"+ge+ge)),be="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ve=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ae=new RegExp(me,"g"),_e=new RegExp(ye,"g"),Ee=new RegExp(t("[^]",be,"[\\.]",'[\\"]',ve),"g"),Se=new RegExp(t("[^]",me,we),"g"),Pe=Se;function xe(e){var t=L(e);return t.match(Ae)?t:e}var ke={scheme:"mailto",parse:function(e,t){var r=e,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var i=!1,o={},a=r.query.split("&"),s=0,c=a.length;snew RegExp(e,t);h.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function b(e){var t,r,n,i,o,a,s,c,u,f,d,p,m,g,y,b,v,w,A,_,E,S,P,x,k;const M=e.strict,C=null===(t=e.code)||void 0===t?void 0:t.optimize,I=!0===C||void 0===C?1:C||0,R=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,N=null!==(i=e.uriResolver)&&void 0!==i?i:l.default;return{strictSchema:null===(a=null!==(o=e.strictSchema)&&void 0!==o?o:M)||void 0===a||a,strictNumbers:null===(c=null!==(s=e.strictNumbers)&&void 0!==s?s:M)||void 0===c||c,strictTypes:null!==(f=null!==(u=e.strictTypes)&&void 0!==u?u:M)&&void 0!==f?f:"log",strictTuples:null!==(p=null!==(d=e.strictTuples)&&void 0!==d?d:M)&&void 0!==p?p:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:M)&&void 0!==g&&g,code:e.code?{...e.code,optimize:I,regExp:R}:{optimize:I,regExp:R},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(b=e.loopEnum)&&void 0!==b?b:200,meta:null===(v=e.meta)||void 0===v||v,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(A=e.inlineRefs)||void 0===A||A,schemaId:null!==(_=e.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(E=e.addUsedSchema)||void 0===E||E,validateSchema:null===(S=e.validateSchema)||void 0===S||S,validateFormats:null===(P=e.validateFormats)||void 0===P||P,unicodeRegExp:null===(x=e.unicodeRegExp)||void 0===x||x,int32range:null===(k=e.int32range)||void 0===k||k,uriResolver:N}}class v{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return x;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,g,e,"NOT SUPPORTED"),w.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await o.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function o(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await o.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=A.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=A.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(M.call(this,r,t),!t)return(0,f.eachItem)(r,(e=>C.call(this,e))),this;R.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,f.eachItem)(r,0===n.type.length?e=>C.call(this,e,n):e=>n.type.forEach((t=>C.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,o=i[e];n&&o&&(i[e]=O(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof e)o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(void 0!==u)return u;r=(0,c.normalizeId)(o||r);const f=c.getSchemaRefs.call(this,e,r);return u=new a.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:f}),this._cache.set(u.schema,u),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,n="error"){for(const i in e){const o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function A(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function E(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function S(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function P(){const e={...this.opts};for(const t of p)delete e[t];return e}e.default=v,v.ValidationError=n.default,v.MissingRefError=i.default;const x={log(){},warn(){},error(){}};const k=/^[a-z_$][a-z0-9_$:-]*$/i;function M(e,t){const{RULES:r}=this;if((0,f.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!k.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function C(e,t,r){var n;const i=null==t?void 0:t.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let a=i?o.post:o.rules.find((({type:e})=>e===r));if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;const s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?I.call(this,a,s,t.before):a.rules.push(s),o.all[e]=s,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function I(e,t,r){const n=e.rules.findIndex((e=>e.keyword===r));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,N]}}}($p);var Gg={},Vg={},Zg={};Object.defineProperty(Zg,"__esModule",{value:!0}),Zg.callRef=Zg.getValidate=void 0;const Xg=Pg,Qg=fm,Yg=Up,ey=Kp,ty=Mg,ry=Hp,ny={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:o,validateName:a,opts:s,self:c}=n,{root:u}=o;if(("#"===r||"#/"===r)&&i===u.baseId)return function(){if(o===u)return oy(e,a,o,o.$async);const r=t.scopeValue("root",{ref:u});return oy(e,Yg._`${r}.validate`,u,u.$async)}();const f=ty.resolveRef.call(c,u,i,r);if(void 0===f)throw new Xg.default(n.opts.uriResolver,i,r);return f instanceof ty.SchemaEnv?function(t){const r=iy(e,t);oy(e,r,t,t.$async)}(f):function(n){const i=t.scopeValue("schema",!0===s.code.source?{ref:n,code:(0,Yg.stringify)(n)}:{ref:n}),o=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:Yg.nil,topSchemaRef:i,errSchemaPath:r},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function iy(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Yg._`${r.scopeValue("wrapper",{ref:t})}.validate`}function oy(e,t,r,n){const{gen:i,it:o}=e,{allErrors:a,schemaEnv:s,opts:c}=o,u=c.passContext?ey.default.this:Yg.nil;function f(e){const t=Yg._`${e}.errors`;i.assign(ey.default.vErrors,Yg._`${ey.default.vErrors} === null ? ${t} : ${ey.default.vErrors}.concat(${t})`),i.assign(ey.default.errors,Yg._`${ey.default.vErrors}.length`)}function d(e){var t;if(!o.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==o.props)if(n&&!n.dynamicProps)void 0!==n.props&&(o.props=ry.mergeEvaluated.props(i,n.props,o.props));else{const t=i.var("props",Yg._`${e}.evaluated.props`);o.props=ry.mergeEvaluated.props(i,t,o.props,Yg.Name)}if(!0!==o.items)if(n&&!n.dynamicItems)void 0!==n.items&&(o.items=ry.mergeEvaluated.items(i,n.items,o.items));else{const t=i.var("items",Yg._`${e}.evaluated.items`);o.items=ry.mergeEvaluated.items(i,t,o.items,Yg.Name)}}n?function(){if(!s.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try((()=>{i.code(Yg._`await ${(0,Qg.callValidateCode)(e,t,u)}`),d(t),a||i.assign(r,!0)}),(e=>{i.if(Yg._`!(${e} instanceof ${o.ValidationError})`,(()=>i.throw(e))),f(e),a||i.assign(r,!1)})),e.ok(r)}():e.result((0,Qg.callValidateCode)(e,t,u),(()=>d(t)),(()=>f(t)))}Zg.getValidate=iy,Zg.callRef=oy,Zg.default=ny,Object.defineProperty(Vg,"__esModule",{value:!0});const ay=["$schema","id","$defs",{keyword:"$comment"},"definitions",Zg.default];Vg.default=ay;var sy={},cy={};Object.defineProperty(cy,"__esModule",{value:!0});const uy=$p,fy=Up.operators,dy={maximum:{exclusive:"exclusiveMaximum",ops:[{okStr:"<=",ok:fy.LTE,fail:fy.GT},{okStr:"<",ok:fy.LT,fail:fy.GTE}]},minimum:{exclusive:"exclusiveMinimum",ops:[{okStr:">=",ok:fy.GTE,fail:fy.LT},{okStr:">",ok:fy.GT,fail:fy.LTE}]}},ly={message:e=>uy.str`must be ${py(e).okStr} ${e.schemaCode}`,params:e=>uy._`{comparison: ${py(e).okStr}, limit: ${e.schemaCode}}`},hy={keyword:Object.keys(dy),type:"number",schemaType:"number",$data:!0,error:ly,code(e){const{data:t,schemaCode:r}=e;e.fail$data(uy._`${t} ${py(e).fail} ${r} || isNaN(${t})`)}};function py(e){var t;const r=e.keyword,n=(null===(t=e.parentSchema)||void 0===t?void 0:t[dy[r].exclusive])?1:0;return dy[r].ops[n]}cy.default=hy;var my={};Object.defineProperty(my,"__esModule",{value:!0});const gy={exclusiveMaximum:"maximum",exclusiveMinimum:"minimum"},yy={keyword:Object.keys(gy),type:"number",schemaType:"boolean",code({keyword:e,parentSchema:t}){const r=gy[e];if(void 0===t[r])throw new Error(`${e} can only be used with ${r}`)}};my.default=yy;var by={};Object.defineProperty(by,"__esModule",{value:!0});const vy=Up,wy={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>vy.str`must be multiple of ${e}`,params:({schemaCode:e})=>vy._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:n,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),s=o?vy._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:vy._`${a} !== parseInt(${a})`;e.fail$data(vy._`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};by.default=wy;var Ay={},_y={};function Ey(e){const t=e.length;let r,n=0,i=0;for(;i=55296&&r<=56319&&iSy.str`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>Sy._`{limit: ${e}}`},My={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ky,code(e){const{keyword:t,data:r,schemaCode:n,it:i}=e,o="maxLength"===t?Sy.operators.GT:Sy.operators.LT,a=!1===i.opts.unicode?Sy._`${r}.length`:Sy._`${(0,Py.useFunc)(e.gen,xy.default)}(${r})`;e.fail$data(Sy._`${a} ${o} ${n}`)}};Ay.default=My;var Cy={};Object.defineProperty(Cy,"__esModule",{value:!0});const Iy=fm,Ry=Up,Ny={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>Ry.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ry._`{pattern: ${e}}`},code(e){const{data:t,$data:r,schema:n,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"",s=r?Ry._`(new RegExp(${i}, ${a}))`:(0,Iy.usePattern)(e,n);e.fail$data(Ry._`!${s}.test(${t})`)}};Cy.default=Ny;var Oy={};Object.defineProperty(Oy,"__esModule",{value:!0});const Ty=Up,jy={message:({keyword:e,schemaCode:t})=>Ty.str`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>Ty._`{limit: ${e}}`},Dy={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:jy,code(e){const{keyword:t,data:r,schemaCode:n}=e,i="maxProperties"===t?Ty.operators.GT:Ty.operators.LT;e.fail$data(Ty._`Object.keys(${r}).length ${i} ${n}`)}};Oy.default=Dy;var $y={};Object.defineProperty($y,"__esModule",{value:!0});const By=fm,Fy=Up,zy=Hp,Uy={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>Fy.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Fy._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:n,data:i,$data:o,it:a}=e,{opts:s}=a;if(!o&&0===r.length)return;const c=r.length>=s.loopRequired;if(a.allErrors?function(){if(c||o)e.block$data(Fy.nil,u);else for(const t of r)(0,By.checkReportMissingProp)(e,t)}():function(){const a=t.let("missing");if(c||o){const r=t.let("valid",!0);e.block$data(r,(()=>function(r,o){e.setParams({missingProperty:r}),t.forOf(r,n,(()=>{t.assign(o,(0,By.propertyInData)(t,i,r,s.ownProperties)),t.if((0,Fy.not)(o),(()=>{e.error(),t.break()}))}),Fy.nil)}(a,r))),e.ok(r)}else t.if((0,By.checkMissingProp)(e,r,a)),(0,By.reportMissingProp)(e,a),t.else()}(),s.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=a.schemaEnv.baseId+a.errSchemaPath;(0,zy.checkStrictMode)(a,`required property "${e}" is not defined at "${t}" (strictRequired)`,a.opts.strictRequired)}}function u(){t.forOf("prop",n,(r=>{e.setParams({missingProperty:r}),t.if((0,By.noPropertyInData)(t,i,r,s.ownProperties),(()=>e.error()))}))}}};$y.default=Uy;var Ly={};Object.defineProperty(Ly,"__esModule",{value:!0});const qy=Up,Hy={message:({keyword:e,schemaCode:t})=>qy.str`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>qy._`{limit: ${e}}`},Ky={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Hy,code(e){const{keyword:t,data:r,schemaCode:n}=e,i="maxItems"===t?qy.operators.GT:qy.operators.LT;e.fail$data(qy._`${r}.length ${i} ${n}`)}};Ly.default=Ky;var Jy={},Wy={};Object.defineProperty(Wy,"__esModule",{value:!0});const Gy=Im;Gy.code='require("ajv/dist/runtime/equal").default',Wy.default=Gy,Object.defineProperty(Jy,"__esModule",{value:!0});const Vy=Yp,Zy=Up,Xy=Hp,Qy=Wy,Yy={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>Zy.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Zy._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:n,schema:i,parentSchema:o,schemaCode:a,it:s}=e;if(!n&&!i)return;const c=t.let("valid"),u=o.items?(0,Vy.getSchemaTypes)(o.items):[];function f(n,i){const o=t.name("item"),a=(0,Vy.checkDataTypes)(u,o,s.opts.strictNumbers,Vy.DataType.Wrong),f=t.const("indices",Zy._`{}`);t.for(Zy._`;${n}--;`,(()=>{t.let(o,Zy._`${r}[${n}]`),t.if(a,Zy._`continue`),u.length>1&&t.if(Zy._`typeof ${o} == "string"`,Zy._`${o} += "_"`),t.if(Zy._`typeof ${f}[${o}] == "number"`,(()=>{t.assign(i,Zy._`${f}[${o}]`),e.error(),t.assign(c,!1).break()})).code(Zy._`${f}[${o}] = ${n}`)}))}function d(n,i){const o=(0,Xy.useFunc)(t,Qy.default),a=t.name("outer");t.label(a).for(Zy._`;${n}--;`,(()=>t.for(Zy._`${i} = ${n}; ${i}--;`,(()=>t.if(Zy._`${o}(${r}[${n}], ${r}[${i}])`,(()=>{e.error(),t.assign(c,!1).break(a)}))))))}e.block$data(c,(function(){const n=t.let("i",Zy._`${r}.length`),i=t.let("j");e.setParams({i:n,j:i}),t.assign(c,!0),t.if(Zy._`${n} > 1`,(()=>(u.length>0&&!u.some((e=>"object"===e||"array"===e))?f:d)(n,i)))}),Zy._`${a} === false`),e.ok(c)}};Jy.default=Yy;var eb={};Object.defineProperty(eb,"__esModule",{value:!0});const tb=Up,rb=Hp,nb=Wy,ib={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>tb._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:n,schemaCode:i,schema:o}=e;n||o&&"object"==typeof o?e.fail$data(tb._`!${(0,rb.useFunc)(t,nb.default)}(${r}, ${i})`):e.fail(tb._`${o} !== ${r}`)}};eb.default=ib;var ob={};Object.defineProperty(ob,"__esModule",{value:!0});const ab=Up,sb=Hp,cb=Wy,ub={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>ab._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e;if(!n&&0===i.length)throw new Error("enum must have non-empty array");const s=i.length>=a.opts.loopEnum;let c;const u=()=>null!=c?c:c=(0,sb.useFunc)(t,cb.default);let f;if(s||n)f=t.let("valid"),e.block$data(f,(function(){t.assign(f,!1),t.forOf("v",o,(e=>t.if(ab._`${u()}(${r}, ${e})`,(()=>t.assign(f,!0).break()))))}));else{if(!Array.isArray(i))throw new Error("ajv implementation error");const e=t.const("vSchema",o);f=(0,ab.or)(...i.map(((t,n)=>function(e,t){const n=i[t];return"object"==typeof n&&null!==n?ab._`${u()}(${r}, ${e}[${t}])`:ab._`${r} === ${n}`}(e,n))))}e.pass(f)}};ob.default=ub,Object.defineProperty(sy,"__esModule",{value:!0});const fb=my,db=by,lb=Ay,hb=Cy,pb=Oy,mb=$y,gb=Ly,yb=Jy,bb=eb,vb=ob,wb=[cy.default,fb.default,db.default,lb.default,hb.default,pb.default,mb.default,gb.default,yb.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},bb.default,vb.default];sy.default=wb;var Ab={},_b={};Object.defineProperty(_b,"__esModule",{value:!0}),_b.validateAdditionalItems=void 0;const Eb=Up,Sb=Hp,Pb={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>Eb.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Eb._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?xb(e,n):(0,Sb.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function xb(e,t){const{gen:r,schema:n,data:i,keyword:o,it:a}=e;a.items=!0;const s=r.const("len",Eb._`${i}.length`);if(!1===n)e.setParams({len:t.length}),e.pass(Eb._`${s} <= ${t.length}`);else if("object"==typeof n&&!(0,Sb.alwaysValidSchema)(a,n)){const n=r.var("valid",Eb._`${s} <= ${t.length}`);r.if((0,Eb.not)(n),(()=>function(n){r.forRange("i",t.length,s,(t=>{e.subschema({keyword:o,dataProp:t,dataPropType:Sb.Type.Num},n),a.allErrors||r.if((0,Eb.not)(n),(()=>r.break()))}))}(n))),e.ok(n)}}_b.validateAdditionalItems=xb,_b.default=Pb;var kb={},Mb={};Object.defineProperty(Mb,"__esModule",{value:!0}),Mb.validateTuple=void 0;const Cb=Up,Ib=Hp,Rb=fm,Nb={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Ob(e,"additionalItems",t);r.items=!0,(0,Ib.alwaysValidSchema)(r,t)||e.ok((0,Rb.validateArray)(e))}};function Ob(e,t,r=e.schema){const{gen:n,parentSchema:i,data:o,keyword:a,it:s}=e;!function(e){const{opts:n,errSchemaPath:i}=s,o=r.length,c=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(n.strictTuples&&!c){const e=`"${a}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${i}"`;(0,Ib.checkStrictMode)(s,e,n.strictTuples)}}(i),s.opts.unevaluated&&r.length&&!0!==s.items&&(s.items=Ib.mergeEvaluated.items(n,r.length,s.items));const c=n.name("valid"),u=n.const("len",Cb._`${o}.length`);r.forEach(((t,r)=>{(0,Ib.alwaysValidSchema)(s,t)||(n.if(Cb._`${u} > ${r}`,(()=>e.subschema({keyword:a,schemaProp:r,dataProp:r},c))),e.ok(c))}))}Mb.validateTuple=Ob,Mb.default=Nb,Object.defineProperty(kb,"__esModule",{value:!0});const Tb=Mb,jb={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Tb.validateTuple)(e,"items")};kb.default=jb;var Db={};Object.defineProperty(Db,"__esModule",{value:!0});const $b=Up,Bb=Hp,Fb=fm,zb=_b,Ub={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>$b.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>$b._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,(0,Bb.alwaysValidSchema)(n,t)||(i?(0,zb.validateAdditionalItems)(e,i):e.ok((0,Fb.validateArray)(e)))}};Db.default=Ub;var Lb={};Object.defineProperty(Lb,"__esModule",{value:!0});const qb=Up,Hb=Hp,Kb={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?qb.str`must contain at least ${e} valid item(s)`:qb.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?qb._`{minContains: ${e}}`:qb._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;let a,s;const{minContains:c,maxContains:u}=n;o.opts.next?(a=void 0===c?1:c,s=u):a=1;const f=t.const("len",qb._`${i}.length`);if(e.setParams({min:a,max:s}),void 0===s&&0===a)return void(0,Hb.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==s&&a>s)return(0,Hb.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,Hb.alwaysValidSchema)(o,r)){let t=qb._`${f} >= ${a}`;return void 0!==s&&(t=qb._`${t} && ${f} <= ${s}`),void e.pass(t)}o.items=!0;const d=t.name("valid");function l(){const e=t.name("_valid"),r=t.let("count",0);h(e,(()=>t.if(e,(()=>function(e){t.code(qb._`${e}++`),void 0===s?t.if(qb._`${e} >= ${a}`,(()=>t.assign(d,!0).break())):(t.if(qb._`${e} > ${s}`,(()=>t.assign(d,!1).break())),1===a?t.assign(d,!0):t.if(qb._`${e} >= ${a}`,(()=>t.assign(d,!0))))}(r)))))}function h(r,n){t.forRange("i",0,f,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:Hb.Type.Num,compositeRule:!0},r),n()}))}void 0===s&&1===a?h(d,(()=>t.if(d,(()=>t.break())))):0===a?(t.let(d,!0),void 0!==s&&t.if(qb._`${i}.length > 0`,l)):(t.let(d,!1),l()),e.result(d,(()=>e.reset()))}};Lb.default=Kb;var Jb={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Up,r=Hp,n=fm;e.error={message:({params:{property:e,depsCount:r,deps:n}})=>t.str`must have ${1===r?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:n,missingProperty:i}})=>t._`{property: ${e}, missingProperty: ${i}, depsCount: ${r}, deps: ${n}}`};const i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);o(e,t),a(e,r)}};function o(e,r=e.schema){const{gen:i,data:o,it:a}=e;if(0===Object.keys(r).length)return;const s=i.let("missing");for(const c in r){const u=r[c];if(0===u.length)continue;const f=(0,n.propertyInData)(i,o,c,a.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),a.allErrors?i.if(f,(()=>{for(const t of u)(0,n.checkReportMissingProp)(e,t)})):(i.if(t._`${f} && (${(0,n.checkMissingProp)(e,u,s)})`),(0,n.reportMissingProp)(e,s),i.else())}}function a(e,t=e.schema){const{gen:i,data:o,keyword:a,it:s}=e,c=i.name("valid");for(const u in t)(0,r.alwaysValidSchema)(s,t[u])||(i.if((0,n.propertyInData)(i,o,u,s.opts.ownProperties),(()=>{const t=e.subschema({keyword:a,schemaProp:u},c);e.mergeValidEvaluated(t,c)}),(()=>i.var(c,!0))),e.ok(c))}e.validatePropertyDeps=o,e.validateSchemaDeps=a,e.default=i}(Jb);var Wb={};Object.defineProperty(Wb,"__esModule",{value:!0});const Gb=Up,Vb=Hp,Zb={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>Gb._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:n,it:i}=e;if((0,Vb.alwaysValidSchema)(i,r))return;const o=t.name("valid");t.forIn("key",n,(r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if((0,Gb.not)(o),(()=>{e.error(!0),i.allErrors||t.break()}))})),e.ok(o)}};Wb.default=Zb;var Xb={};Object.defineProperty(Xb,"__esModule",{value:!0});const Qb=fm,Yb=Up,ev=Kp,tv=Hp,rv={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>Yb._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:n,data:i,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:s,opts:c}=a;if(a.props=!0,"all"!==c.removeAdditional&&(0,tv.alwaysValidSchema)(a,r))return;const u=(0,Qb.allSchemaProperties)(n.properties),f=(0,Qb.allSchemaProperties)(n.patternProperties);function d(e){t.code(Yb._`delete ${i}[${e}]`)}function l(n){if("all"===c.removeAdditional||c.removeAdditional&&!1===r)d(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(s||t.break());if("object"==typeof r&&!(0,tv.alwaysValidSchema)(a,r)){const r=t.name("valid");"failing"===c.removeAdditional?(h(n,r,!1),t.if((0,Yb.not)(r),(()=>{e.reset(),d(n)}))):(h(n,r),s||t.if((0,Yb.not)(r),(()=>t.break())))}}}function h(t,r,n){const i={keyword:"additionalProperties",dataProp:t,dataPropType:tv.Type.Str};!1===n&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",i,(r=>{u.length||f.length?t.if(function(r){let i;if(u.length>8){const e=(0,tv.schemaRefOrVal)(a,n.properties,"properties");i=(0,Qb.isOwnProperty)(t,e,r)}else i=u.length?(0,Yb.or)(...u.map((e=>Yb._`${r} === ${e}`))):Yb.nil;return f.length&&(i=(0,Yb.or)(i,...f.map((t=>Yb._`${(0,Qb.usePattern)(e,t)}.test(${r})`)))),(0,Yb.not)(i)}(r),(()=>l(r))):l(r)})),e.ok(Yb._`${o} === ${ev.default.errors}`)}};Xb.default=rv;var nv={};Object.defineProperty(nv,"__esModule",{value:!0});const iv=Bp,ov=fm,av=Hp,sv=Xb,cv={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;"all"===o.opts.removeAdditional&&void 0===n.additionalProperties&&sv.default.code(new iv.KeywordCxt(o,sv.default,"additionalProperties"));const a=(0,ov.allSchemaProperties)(r);for(const e of a)o.definedProperties.add(e);o.opts.unevaluated&&a.length&&!0!==o.props&&(o.props=av.mergeEvaluated.props(t,(0,av.toHash)(a),o.props));const s=a.filter((e=>!(0,av.alwaysValidSchema)(o,r[e])));if(0===s.length)return;const c=t.name("valid");for(const r of s)u(r)?f(r):(t.if((0,ov.propertyInData)(t,i,r,o.opts.ownProperties)),f(r),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(c);function u(e){return o.opts.useDefaults&&!o.compositeRule&&void 0!==r[e].default}function f(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}};nv.default=cv;var uv={};Object.defineProperty(uv,"__esModule",{value:!0});const fv=fm,dv=Up,lv=Hp,hv=Hp,pv={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:i,it:o}=e,{opts:a}=o,s=(0,fv.allSchemaProperties)(r),c=s.filter((e=>(0,lv.alwaysValidSchema)(o,r[e])));if(0===s.length||c.length===s.length&&(!o.opts.unevaluated||!0===o.props))return;const u=a.strictSchema&&!a.allowMatchingProperties&&i.properties,f=t.name("valid");!0===o.props||o.props instanceof dv.Name||(o.props=(0,hv.evaluatedPropsToName)(t,o.props));const{props:d}=o;function l(e){for(const t in u)new RegExp(e).test(t)&&(0,lv.checkStrictMode)(o,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function h(r){t.forIn("key",n,(n=>{t.if(dv._`${(0,fv.usePattern)(e,r)}.test(${n})`,(()=>{const i=c.includes(r);i||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:hv.Type.Str},f),o.opts.unevaluated&&!0!==d?t.assign(dv._`${d}[${n}]`,!0):i||o.allErrors||t.if((0,dv.not)(f),(()=>t.break()))}))}))}!function(){for(const e of s)u&&l(e),o.allErrors?h(e):(t.var(f,!0),h(e),t.if(f))}()}};uv.default=pv;var mv={};Object.defineProperty(mv,"__esModule",{value:!0});const gv=Hp,yv={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,gv.alwaysValidSchema)(n,r))return void e.fail();const i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};mv.default=yv;var bv={};Object.defineProperty(bv,"__esModule",{value:!0});const vv={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:fm.validateUnion,error:{message:"must match a schema in anyOf"}};bv.default=vv;var wv={};Object.defineProperty(wv,"__esModule",{value:!0});const Av=Up,_v=Hp,Ev={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>Av._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;const o=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block((function(){o.forEach(((r,n)=>{let o;(0,_v.alwaysValidSchema)(i,r)?t.var(c,!0):o=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&t.if(Av._`${c} && ${a}`).assign(a,!1).assign(s,Av._`[${s}, ${n}]`).else(),t.if(c,(()=>{t.assign(a,!0),t.assign(s,n),o&&e.mergeEvaluated(o,Av.Name)}))}))})),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}};wv.default=Ev;var Sv={};Object.defineProperty(Sv,"__esModule",{value:!0});const Pv=Hp,xv={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const i=t.name("valid");r.forEach(((t,r)=>{if((0,Pv.alwaysValidSchema)(n,t))return;const o=e.subschema({keyword:"allOf",schemaProp:r},i);e.ok(i),e.mergeEvaluated(o)}))}};Sv.default=xv;var kv={};Object.defineProperty(kv,"__esModule",{value:!0});const Mv=Up,Cv=Hp,Iv={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>Mv.str`must match "${e.ifClause}" schema`,params:({params:e})=>Mv._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:n}=e;void 0===r.then&&void 0===r.else&&(0,Cv.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const i=Rv(n,"then"),o=Rv(n,"else");if(!i&&!o)return;const a=t.let("valid",!0),s=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(t)}(),e.reset(),i&&o){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(s,c("then",r),c("else",r))}else i?t.if(s,c("then")):t.if((0,Mv.not)(s),c("else"));function c(r,n){return()=>{const i=e.subschema({keyword:r},s);t.assign(a,s),e.mergeValidEvaluated(i,a),n?t.assign(n,Mv._`${r}`):e.setParams({ifClause:r})}}e.pass(a,(()=>e.error(!0)))}};function Rv(e,t){const r=e.schema[t];return void 0!==r&&!(0,Cv.alwaysValidSchema)(e,r)}kv.default=Iv;var Nv={};Object.defineProperty(Nv,"__esModule",{value:!0});const Ov=Hp,Tv={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,Ov.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Nv.default=Tv,Object.defineProperty(Ab,"__esModule",{value:!0});const jv=_b,Dv=kb,$v=Mb,Bv=Db,Fv=Lb,zv=Jb,Uv=Wb,Lv=Xb,qv=nv,Hv=uv,Kv=mv,Jv=bv,Wv=wv,Gv=Sv,Vv=kv,Zv=Nv;Ab.default=function(e=!1){const t=[Kv.default,Jv.default,Wv.default,Gv.default,Vv.default,Zv.default,Uv.default,Lv.default,zv.default,qv.default,Hv.default];return e?t.push(Dv.default,Bv.default):t.push(jv.default,$v.default),t.push(Fv.default),t};var Xv={},Qv={};Object.defineProperty(Qv,"__esModule",{value:!0});const Yv=Up,ew={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>Yv.str`must match format "${e}"`,params:({schemaCode:e})=>Yv._`{format: ${e}}`},code(e,t){const{gen:r,data:n,$data:i,schema:o,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:f,self:d}=s;c.validateFormats&&(i?function(){const i=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=r.const("fDef",Yv._`${i}[${a}]`),s=r.let("fType"),u=r.let("format");r.if(Yv._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>r.assign(s,Yv._`${o}.type || "string"`).assign(u,Yv._`${o}.validate`)),(()=>r.assign(s,Yv._`"string"`).assign(u,o))),e.fail$data((0,Yv.or)(!1===c.strictSchema?Yv.nil:Yv._`${a} && !${u}`,function(){const e=f.$async?Yv._`(${o}.async ? await ${u}(${n}) : ${u}(${n}))`:Yv._`${u}(${n})`,r=Yv._`(typeof ${u} == "function" ? ${e} : ${u}.test(${n}))`;return Yv._`${u} && ${u} !== true && ${s} === ${t} && !${r}`}()))}():function(){const i=d.formats[o];if(!i)return void function(){if(!1===c.strictSchema)return void d.logger.warn(e());throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}();if(!0===i)return;const[a,s,l]=function(e){const t=e instanceof RegExp?(0,Yv.regexpCode)(e):c.code.formats?Yv._`${c.code.formats}${(0,Yv.getProperty)(o)}`:void 0,n=r.scopeValue("formats",{key:o,ref:e,code:t});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,Yv._`${n}.validate`];return["string",e,n]}(i);a===t&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!f.$async)throw new Error("async format in sync schema");return Yv._`await ${l}(${n})`}return"function"==typeof s?Yv._`${l}(${n})`:Yv._`${l}.test(${n})`}())}())}};Qv.default=ew,Object.defineProperty(Xv,"__esModule",{value:!0});const tw=[Qv.default];Xv.default=tw,Object.defineProperty(Gg,"__esModule",{value:!0});const rw=sy,nw=Ab,iw=Xv,ow=[Vg.default,rw.default,nw.default(),iw.default,["title","description","default"]];Gg.default=ow;var aw={},sw={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(t=e.DiscrError||(e.DiscrError={})).Tag="tag",t.Mapping="mapping"}(sw),Object.defineProperty(aw,"__esModule",{value:!0});const cw=Up,uw=sw,fw=Mg,dw=Hp,lw={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===uw.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>cw._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:n,parentSchema:i,it:o}=e,{oneOf:a}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const s=n.propertyName;if("string"!=typeof s)throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),u=t.const("tag",cw._`${r}${(0,cw.getProperty)(s)}`);function f(r){const n=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(i,cw.Name),n}t.if(cw._`typeof ${u} == "string"`,(()=>function(){const r=function(){var e;const t={},r=c(i);let n=!0;for(let t=0;te.error(!1,{discrError:uw.DiscrError.Tag,tag:u,tagName:s}))),e.ok(c)}};aw.default=lw;var hw={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=$p,n=Gg,i=aw,o=hw,a=["/properties"],s="http://json-schema.org/draft-04/schema";class c extends r.default{constructor(e={}){super({...e,schemaId:"id"})}_addVocabularies(){super._addVocabularies(),n.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=$p;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var f=$p;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}})}(Dp,Dp.exports);var pw=f(Dp.exports),mw={exports:{}},gw={};!function(e){function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(i,o),time:t(s,c),"date-time":t((function(e){const t=e.split(u);return 2===t.length&&i(t[0])&&s(t[1],!0)}),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return d.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(y.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return h.lastIndex=0,h.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=m&&e>=p}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:g},double:{type:"number",validate:g},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){const t=r.exec(e);if(!t)return!1;const i=+t[1],o=+t[2],a=+t[3];return o>=1&&o<=12&&a>=1&&a<=(2===o&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(i)?29:n[o])}function o(e,t){if(e&&t)return e>t?1:e(t=n[1]+n[2]+n[3]+(n[4]||""))?1:e=",ok:Mw.GTE,fail:Mw.LT},exclusiveMaximum:{okStr:"<",ok:Mw.LT,fail:Mw.GTE},exclusiveMinimum:{okStr:">",ok:Mw.GT,fail:Mw.LTE}},Iw={message:({keyword:e,schemaCode:t})=>kw.str`must be ${Cw[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>kw._`{comparison: ${Cw[e].okStr}, limit: ${t}}`},Rw={keyword:Object.keys(Cw),type:"number",schemaType:"number",$data:!0,error:Iw,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(kw._`${r} ${Cw[t].fail} ${n} || isNaN(${r})`)}};xw.default=Rw,Object.defineProperty(Pw,"__esModule",{value:!0});const Nw=by,Ow=Ay,Tw=Cy,jw=Oy,Dw=$y,$w=Ly,Bw=Jy,Fw=eb,zw=ob,Uw=[xw.default,Nw.default,Ow.default,Tw.default,jw.default,Dw.default,$w.default,Bw.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Fw.default,zw.default];Pw.default=Uw;var Lw={};Object.defineProperty(Lw,"__esModule",{value:!0}),Lw.contentVocabulary=Lw.metadataVocabulary=void 0,Lw.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Lw.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(vw,"__esModule",{value:!0});const qw=Pw,Hw=Ab,Kw=Xv,Jw=Lw,Ww=[ww.default,qw.default,(0,Hw.default)(),Kw.default,Jw.metadataVocabulary,Jw.contentVocabulary];vw.default=Ww;var Gw={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=$p,n=vw,i=aw,o=Gw,a=["/properties"],s="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=Bp;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var f=Up;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var d=Eg;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var l=Pg;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return l.default}})}(bw,bw.exports);var Vw=bw.exports;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=Vw,r=Up,n=r.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},o={message:({keyword:e,schemaCode:t})=>r.str`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${i[e].okStr}, limit: ${t}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:o,code(e){const{gen:n,data:o,schemaCode:a,keyword:s,it:c}=e,{opts:u,self:f}=c;if(!u.validateFormats)return;const d=new t.KeywordCxt(c,f.RULES.all.format.definition,"format");function l(e){return r._`${e}.compare(${o}, ${a}) ${i[s].fail} 0`}d.$data?function(){const t=n.scopeValue("formats",{ref:f.formats,code:u.code.formats}),i=n.const("fmt",r._`${t}[${d.schemaCode}]`);e.fail$data(r.or(r._`typeof ${i} != "object"`,r._`${i} instanceof RegExp`,r._`typeof ${i}.compare != "function"`,l(i)))}():function(){const t=d.schema,i=f.formats[t];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${s}": format "${t}" does not define "compare" function`);const o=n.scopeValue("formats",{key:t,ref:i,code:u.code.formats?r._`${u.code.formats}${r.getProperty(t)}`:void 0});e.fail$data(l(o))}()},dependencies:["format"]};e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}(yw),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=gw,n=yw,i=Up,o=new i.Name("fullFormats"),a=new i.Name("fastFormats"),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,r.fullFormats,o),e;const[i,s]="fast"===t.mode?[r.fastFormats,a]:[r.fullFormats,o];return c(e,t.formats||r.formatNames,i,s),t.keywords&&n.default(e),e};function c(e,t,r,n){var o,a;null!==(o=(a=e.opts.code).formats)&&void 0!==o||(a.formats=i._`require("ajv-formats/dist/formats").${n}`);for(const n of t)e.addFormat(n,r[n])}s.get=(e,t="full")=>{const n=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n},e.exports=t=s,Object.defineProperty(t,"__esModule",{value:!0}),t.default=s}(mw,mw.exports);var Zw=f(mw.exports),Xw={exports:{}};!function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=16,s=32,c=64,f=128,d=256,l=1/0,h=9007199254740991,p=NaN,m=4294967295,g=[["ary",f],["bind",1],["bindKey",2],["curry",8],["curryRight",a],["flip",512],["partial",s],["partialRight",c],["rearg",d]],y="[object Arguments]",b="[object Array]",v="[object Boolean]",w="[object Date]",A="[object Error]",_="[object Function]",E="[object GeneratorFunction]",S="[object Map]",P="[object Number]",x="[object Object]",k="[object Promise]",M="[object RegExp]",C="[object Set]",I="[object String]",R="[object Symbol]",N="[object WeakMap]",O="[object ArrayBuffer]",T="[object DataView]",j="[object Float32Array]",D="[object Float64Array]",$="[object Int8Array]",B="[object Int16Array]",F="[object Int32Array]",z="[object Uint8Array]",U="[object Uint8ClampedArray]",L="[object Uint16Array]",q="[object Uint32Array]",H=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,V=RegExp(W.source),Z=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(ne.source),oe=/^\s+/,ae=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ce=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,de=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ge=/^0b[01]+$/i,ye=/^\[object .+?Constructor\]$/,be=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ae=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,Ee="\\ud800-\\udfff",Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",xe="a-z\\xdf-\\xf6\\xf8-\\xff",ke="A-Z\\xc0-\\xd6\\xd8-\\xde",Me="\\ufe0e\\ufe0f",Ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ie="['’]",Re="["+Ee+"]",Ne="["+Ce+"]",Oe="["+Se+"]",Te="\\d+",je="["+Pe+"]",De="["+xe+"]",$e="[^"+Ee+Ce+Te+Pe+xe+ke+"]",Be="\\ud83c[\\udffb-\\udfff]",Fe="[^"+Ee+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Ue="[\\ud800-\\udbff][\\udc00-\\udfff]",Le="["+ke+"]",qe="\\u200d",He="(?:"+De+"|"+$e+")",Ke="(?:"+Le+"|"+$e+")",Je="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ge="(?:"+Oe+"|"+Be+")"+"?",Ve="["+Me+"]?",Ze=Ve+Ge+("(?:"+qe+"(?:"+[Fe,ze,Ue].join("|")+")"+Ve+Ge+")*"),Xe="(?:"+[je,ze,Ue].join("|")+")"+Ze,Qe="(?:"+[Fe+Oe+"?",Oe,ze,Ue,Re].join("|")+")",Ye=RegExp(Ie,"g"),et=RegExp(Oe,"g"),tt=RegExp(Be+"(?="+Be+")|"+Qe+Ze,"g"),rt=RegExp([Le+"?"+De+"+"+Je+"(?="+[Ne,Le,"$"].join("|")+")",Ke+"+"+We+"(?="+[Ne,Le+He,"$"].join("|")+")",Le+"?"+He+"+"+Je,Le+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Te,Xe].join("|"),"g"),nt=RegExp("["+qe+Ee+Se+Me+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ot=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],at=-1,st={};st[j]=st[D]=st[$]=st[B]=st[F]=st[z]=st[U]=st[L]=st[q]=!0,st[y]=st[b]=st[O]=st[v]=st[T]=st[w]=st[A]=st[_]=st[S]=st[P]=st[x]=st[M]=st[C]=st[I]=st[N]=!1;var ct={};ct[y]=ct[b]=ct[O]=ct[T]=ct[v]=ct[w]=ct[j]=ct[D]=ct[$]=ct[B]=ct[F]=ct[S]=ct[P]=ct[x]=ct[M]=ct[C]=ct[I]=ct[R]=ct[z]=ct[U]=ct[L]=ct[q]=!0,ct[A]=ct[_]=ct[N]=!1;var ut={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ft=parseFloat,dt=parseInt,lt="object"==typeof u&&u&&u.Object===Object&&u,ht="object"==typeof self&&self&&self.Object===Object&&self,pt=lt||ht||Function("return this")(),mt=t&&!t.nodeType&&t,gt=mt&&e&&!e.nodeType&&e,yt=gt&>.exports===mt,bt=yt&<.process,vt=function(){try{var e=gt&>.require&>.require("util").types;return e||bt&&bt.binding&&bt.binding("util")}catch(e){}}(),wt=vt&&vt.isArrayBuffer,At=vt&&vt.isDate,_t=vt&&vt.isMap,Et=vt&&vt.isRegExp,St=vt&&vt.isSet,Pt=vt&&vt.isTypedArray;function xt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function kt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i-1}function Ot(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function rr(e,t){for(var r=e.length;r--&&Lt(t,e[r],0)>-1;);return r}var nr=Wt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Wt({"&":"&","<":"<",">":">",'"':""","'":"'"});function or(e){return"\\"+ut[e]}function ar(e){return nt.test(e)}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function cr(e,t){return function(r){return e(t(r))}}function ur(e,t){for(var r=-1,n=e.length,i=0,a=[];++r",""":'"',"'":"'"});var gr=function e(t){var u,ae=(t=null==t?pt:gr.defaults(pt.Object(),t,gr.pick(pt,ot))).Array,Ee=t.Date,Se=t.Error,Pe=t.Function,xe=t.Math,ke=t.Object,Me=t.RegExp,Ce=t.String,Ie=t.TypeError,Re=ae.prototype,Ne=Pe.prototype,Oe=ke.prototype,Te=t["__core-js_shared__"],je=Ne.toString,De=Oe.hasOwnProperty,$e=0,Be=(u=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+u:"",Fe=Oe.toString,ze=je.call(ke),Ue=pt._,Le=Me("^"+je.call(De).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=yt?t.Buffer:r,He=t.Symbol,Ke=t.Uint8Array,Je=qe?qe.allocUnsafe:r,We=cr(ke.getPrototypeOf,ke),Ge=ke.create,Ve=Oe.propertyIsEnumerable,Ze=Re.splice,Xe=He?He.isConcatSpreadable:r,Qe=He?He.iterator:r,tt=He?He.toStringTag:r,nt=function(){try{var e=ho(ke,"defineProperty");return e({},"",{}),e}catch(e){}}(),ut=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,lt=Ee&&Ee.now!==pt.Date.now&&Ee.now,ht=t.setTimeout!==pt.setTimeout&&t.setTimeout,mt=xe.ceil,gt=xe.floor,bt=ke.getOwnPropertySymbols,vt=qe?qe.isBuffer:r,Ft=t.isFinite,Wt=Re.join,yr=cr(ke.keys,ke),br=xe.max,vr=xe.min,wr=Ee.now,Ar=t.parseInt,_r=xe.random,Er=Re.reverse,Sr=ho(t,"DataView"),Pr=ho(t,"Map"),xr=ho(t,"Promise"),kr=ho(t,"Set"),Mr=ho(t,"WeakMap"),Cr=ho(ke,"create"),Ir=Mr&&new Mr,Rr={},Nr=Fo(Sr),Or=Fo(Pr),Tr=Fo(xr),jr=Fo(kr),Dr=Fo(Mr),$r=He?He.prototype:r,Br=$r?$r.valueOf:r,Fr=$r?$r.toString:r;function zr(e){if(rs(e)&&!Ka(e)&&!(e instanceof Hr)){if(e instanceof qr)return e;if(De.call(e,"__wrapped__"))return zo(e)}return new qr(e)}var Ur=function(){function e(){}return function(t){if(!ts(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function Lr(){}function qr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Hr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Kr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function un(e,t,n,i,o,a){var s,c=1&t,u=2&t,f=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!ts(e))return e;var d=Ka(e);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&De.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!c)return Ii(e,s)}else{var l=go(e),h=l==_||l==E;if(Va(e))return Si(e,c);if(l==x||l==y||h&&!o){if(s=u||h?{}:bo(e),!c)return u?function(e,t){return Ri(e,mo(e),t)}(e,function(e,t){return e&&Ri(t,Os(t),e)}(s,e)):function(e,t){return Ri(e,po(e),t)}(e,on(s,e))}else{if(!ct[l])return o?e:{};s=function(e,t,r){var n=e.constructor;switch(t){case O:return Pi(e);case v:case w:return new n(+e);case T:return function(e,t){var r=t?Pi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case j:case D:case $:case B:case F:case z:case U:case L:case q:return xi(e,r);case S:return new n;case P:case I:return new n(e);case M:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case C:return new n;case R:return i=e,Br?ke(Br.call(i)):{}}var i}(e,l,c)}}a||(a=new Vr);var p=a.get(e);if(p)return p;a.set(e,s),ss(e)?e.forEach((function(r){s.add(un(r,t,n,r,e,a))})):ns(e)&&e.forEach((function(r,i){s.set(i,un(r,t,n,i,e,a))}));var m=d?r:(f?u?oo:io:u?Os:Ns)(e);return Mt(m||e,(function(r,i){m&&(r=e[i=r]),tn(s,i,un(r,t,n,i,e,a))})),s}function fn(e,t,n){var i=n.length;if(null==e)return!i;for(e=ke(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function dn(e,t,i){if("function"!=typeof e)throw new Ie(n);return No((function(){e.apply(r,i)}),t)}function ln(e,t,r,n){var i=-1,o=Nt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;r&&(t=Tt(t,Qt(r))),n?(o=Ot,a=!1):t.length>=200&&(o=er,a=!1,t=new Gr(t));e:for(;++i-1},Jr.prototype.set=function(e,t){var r=this.__data__,n=rn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Wr.prototype.clear=function(){this.size=0,this.__data__={hash:new Kr,map:new(Pr||Jr),string:new Kr}},Wr.prototype.delete=function(e){var t=fo(this,e).delete(e);return this.size-=t?1:0,t},Wr.prototype.get=function(e){return fo(this,e).get(e)},Wr.prototype.has=function(e){return fo(this,e).has(e)},Wr.prototype.set=function(e,t){var r=fo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Gr.prototype.add=Gr.prototype.push=function(e){return this.__data__.set(e,i),this},Gr.prototype.has=function(e){return this.__data__.has(e)},Vr.prototype.clear=function(){this.__data__=new Jr,this.size=0},Vr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Vr.prototype.get=function(e){return this.__data__.get(e)},Vr.prototype.has=function(e){return this.__data__.has(e)},Vr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Jr){var n=r.__data__;if(!Pr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Wr(n)}return r.set(e,t),this.size=r.size,this};var hn=Ti(An),pn=Ti(_n,!0);function mn(e,t){var r=!0;return hn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function gn(e,t,n){for(var i=-1,o=e.length;++i0&&r(s)?t>1?bn(s,t-1,r,n,i):jt(i,s):n||(i[i.length]=s)}return i}var vn=ji(),wn=ji(!0);function An(e,t){return e&&vn(e,t,Ns)}function _n(e,t){return e&&wn(e,t,Ns)}function En(e,t){return Rt(t,(function(t){return Qa(e[t])}))}function Sn(e,t){for(var n=0,i=(t=wi(t,e)).length;null!=e&&nt}function Mn(e,t){return null!=e&&De.call(e,t)}function Cn(e,t){return null!=e&&t in ke(e)}function In(e,t,n){for(var i=n?Ot:Nt,o=e[0].length,a=e.length,s=a,c=ae(a),u=1/0,f=[];s--;){var d=e[s];s&&t&&(d=Tt(d,Qt(t))),u=vr(d.length,u),c[s]=!n&&(t||o>=120&&d.length>=120)?new Gr(s&&d):r}d=e[0];var l=-1,h=c[0];e:for(;++l=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function Jn(e,t,r){for(var n=-1,i=t.length,o={};++n-1;)s!==e&&Ze.call(s,c,1),Ze.call(e,c,1);return e}function Gn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;wo(i)?Ze.call(e,i,1):li(e,i)}}return e}function Vn(e,t){return e+gt(_r()*(t-e+1))}function Zn(e,t){var r="";if(!e||t<1||t>h)return r;do{t%2&&(r+=e),(t=gt(t/2))&&(e+=e)}while(t);return r}function Xn(e,t){return Oo(Mo(e,t,ic),e+"")}function Qn(e){return Xr(Us(e))}function Yn(e,t){var r=Us(e);return Do(r,cn(t,0,r.length))}function ei(e,t,n,i){if(!ts(e))return e;for(var o=-1,a=(t=wi(t,e)).length,s=a-1,c=e;null!=c&&++oi?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=ae(i);++n>>1,a=e[o];null!==a&&!us(a)&&(r?a<=t:a=200){var u=t?null:Zi(e);if(u)return fr(u);a=!1,i=er,c=new Gr}else c=t?[]:s;e:for(;++n=i?e:ii(e,t,n)}var Ei=ut||function(e){return pt.clearTimeout(e)};function Si(e,t){if(t)return e.slice();var r=e.length,n=Je?Je(r):new e.constructor(r);return e.copy(n),n}function Pi(e){var t=new e.constructor(e.byteLength);return new Ke(t).set(new Ke(e)),t}function xi(e,t){var r=t?Pi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ki(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=us(e),s=t!==r,c=null===t,u=t==t,f=us(t);if(!c&&!f&&!a&&e>t||a&&s&&u&&!c&&!f||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!f&&e1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&Ao(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=ke(t);++i-1?o[a?t[s]:s]:r}}function zi(e){return no((function(t){var i=t.length,o=i,a=qr.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ie(n);if(a&&!c&&"wrapper"==so(s))var c=new qr([],!0)}for(o=c?o:i;++o1&&v.reverse(),l&&uc))return!1;var f=a.get(e),d=a.get(t);if(f&&d)return f==t&&d==e;var l=-1,h=!0,p=2&n?new Gr:r;for(a.set(e,t),a.set(t,e);++l-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Mt(g,(function(r){var n="_."+r[0];t&r[1]&&!Nt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ce);return t?t[1].split(ue):[]}(n),r)))}function jo(e){var t=0,n=0;return function(){var i=wr(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Do(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,aa(e,n)}));function ha(e){var t=zr(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ma=no((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return sn(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Hr&&wo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new qr(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(o)}));var ga=Ni((function(e,t,r){De.call(e,r)?++e[r]:an(e,r,1)}));var ya=Fi(Ho),ba=Fi(Ko);function va(e,t){return(Ka(e)?Mt:hn)(e,uo(t,3))}function wa(e,t){return(Ka(e)?Ct:pn)(e,uo(t,3))}var Aa=Ni((function(e,t,r){De.call(e,r)?e[r].push(t):an(e,r,[t])}));var _a=Xn((function(e,t,r){var n=-1,i="function"==typeof t,o=Wa(e)?ae(e.length):[];return hn(e,(function(e){o[++n]=i?xt(t,e,r):Rn(e,t,r)})),o})),Ea=Ni((function(e,t,r){an(e,r,t)}));function Sa(e,t){return(Ka(e)?Tt:zn)(e,uo(t,3))}var Pa=Ni((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var xa=Xn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&Ao(e,t[0],t[1])?t=[]:r>2&&Ao(t[0],t[1],t[2])&&(t=[t[0]]),Kn(e,bn(t,1),[])})),ka=lt||function(){return pt.Date.now()};function Ma(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Qi(e,f,r,r,r,r,t)}function Ca(e,t){var i;if("function"!=typeof t)throw new Ie(n);return e=ms(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ia=Xn((function(e,t,r){var n=1;if(r.length){var i=ur(r,co(Ia));n|=s}return Qi(e,n,t,r,i)})),Ra=Xn((function(e,t,r){var n=3;if(r.length){var i=ur(r,co(Ra));n|=s}return Qi(t,n,e,r,i)}));function Na(e,t,i){var o,a,s,c,u,f,d=0,l=!1,h=!1,p=!0;if("function"!=typeof e)throw new Ie(n);function m(t){var n=o,i=a;return o=a=r,d=t,c=e.apply(i,n)}function g(e){var n=e-f;return f===r||n>=t||n<0||h&&e-d>=s}function y(){var e=ka();if(g(e))return b(e);u=No(y,function(e){var r=t-(e-f);return h?vr(r,s-(e-d)):r}(e))}function b(e){return u=r,p&&o?m(e):(o=a=r,c)}function v(){var e=ka(),n=g(e);if(o=arguments,a=this,f=e,n){if(u===r)return function(e){return d=e,u=No(y,t),l?m(e):c}(f);if(h)return Ei(u),u=No(y,t),m(f)}return u===r&&(u=No(y,t)),c}return t=ys(t)||0,ts(i)&&(l=!!i.leading,s=(h="maxWait"in i)?br(ys(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),v.cancel=function(){u!==r&&Ei(u),d=0,o=f=a=u=r},v.flush=function(){return u===r?c:b(ka())},v}var Oa=Xn((function(e,t){return dn(e,1,t)})),Ta=Xn((function(e,t,r){return dn(e,ys(t)||0,r)}));function ja(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ie(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(ja.Cache||Wr),r}function Da(e){if("function"!=typeof e)throw new Ie(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ja.Cache=Wr;var $a=Ai((function(e,t){var r=(t=1==t.length&&Ka(t[0])?Tt(t[0],Qt(uo())):Tt(bn(t,1),Qt(uo()))).length;return Xn((function(n){for(var i=-1,o=vr(n.length,r);++i=t})),Ha=Nn(function(){return arguments}())?Nn:function(e){return rs(e)&&De.call(e,"callee")&&!Ve.call(e,"callee")},Ka=ae.isArray,Ja=wt?Qt(wt):function(e){return rs(e)&&xn(e)==O};function Wa(e){return null!=e&&es(e.length)&&!Qa(e)}function Ga(e){return rs(e)&&Wa(e)}var Va=vt||yc,Za=At?Qt(At):function(e){return rs(e)&&xn(e)==w};function Xa(e){if(!rs(e))return!1;var t=xn(e);return t==A||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!os(e)}function Qa(e){if(!ts(e))return!1;var t=xn(e);return t==_||t==E||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ya(e){return"number"==typeof e&&e==ms(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function rs(e){return null!=e&&"object"==typeof e}var ns=_t?Qt(_t):function(e){return rs(e)&&go(e)==S};function is(e){return"number"==typeof e||rs(e)&&xn(e)==P}function os(e){if(!rs(e)||xn(e)!=x)return!1;var t=We(e);if(null===t)return!0;var r=De.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&je.call(r)==ze}var as=Et?Qt(Et):function(e){return rs(e)&&xn(e)==M};var ss=St?Qt(St):function(e){return rs(e)&&go(e)==C};function cs(e){return"string"==typeof e||!Ka(e)&&rs(e)&&xn(e)==I}function us(e){return"symbol"==typeof e||rs(e)&&xn(e)==R}var fs=Pt?Qt(Pt):function(e){return rs(e)&&es(e.length)&&!!st[xn(e)]};var ds=Wi(Fn),ls=Wi((function(e,t){return e<=t}));function hs(e){if(!e)return[];if(Wa(e))return cs(e)?hr(e):Ii(e);if(Qe&&e[Qe])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Qe]());var t=go(e);return(t==S?sr:t==C?fr:Us)(e)}function ps(e){return e?(e=ys(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ms(e){var t=ps(e),r=t%1;return t==t?r?t-r:t:0}function gs(e){return e?cn(ms(e),0,m):0}function ys(e){if("number"==typeof e)return e;if(us(e))return p;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Xt(e);var r=ge.test(e);return r||be.test(e)?dt(e.slice(2),r?2:8):me.test(e)?p:+e}function bs(e){return Ri(e,Os(e))}function vs(e){return null==e?"":fi(e)}var ws=Oi((function(e,t){if(Po(t)||Wa(t))Ri(t,Ns(t),e);else for(var r in t)De.call(t,r)&&tn(e,r,t[r])})),As=Oi((function(e,t){Ri(t,Os(t),e)})),_s=Oi((function(e,t,r,n){Ri(t,Os(t),e,n)})),Es=Oi((function(e,t,r,n){Ri(t,Ns(t),e,n)})),Ss=no(sn);var Ps=Xn((function(e,t){e=ke(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&Ao(t[0],t[1],o)&&(i=1);++n1),t})),Ri(e,oo(e),r),n&&(r=un(r,7,to));for(var i=t.length;i--;)li(r,t[i]);return r}));var $s=no((function(e,t){return null==e?{}:function(e,t){return Jn(e,t,(function(t,r){return Ms(e,r)}))}(e,t)}));function Bs(e,t){if(null==e)return{};var r=Tt(oo(e),(function(e){return[e]}));return t=uo(t),Jn(e,r,(function(e,r){return t(e,r[0])}))}var Fs=Xi(Ns),zs=Xi(Os);function Us(e){return null==e?[]:Yt(e,Ns(e))}var Ls=$i((function(e,t,r){return t=t.toLowerCase(),e+(r?qs(t):t)}));function qs(e){return Xs(vs(e).toLowerCase())}function Hs(e){return(e=vs(e))&&e.replace(we,nr).replace(et,"")}var Ks=$i((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Js=$i((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ws=Di("toLowerCase");var Gs=$i((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Vs=$i((function(e,t,r){return e+(r?" ":"")+Xs(t)}));var Zs=$i((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Xs=Di("toUpperCase");function Qs(e,t,n){return e=vs(e),(t=n?r:t)===r?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(fe)||[]}(e):e.match(t)||[]}var Ys=Xn((function(e,t){try{return xt(e,r,t)}catch(e){return Xa(e)?e:new Se(e)}})),ec=no((function(e,t){return Mt(t,(function(t){t=Bo(t),an(e,t,Ia(e[t],e))})),e}));function tc(e){return function(){return e}}var rc=zi(),nc=zi(!0);function ic(e){return e}function oc(e){return Dn("function"==typeof e?e:un(e,1))}var ac=Xn((function(e,t){return function(r){return Rn(r,e,t)}})),sc=Xn((function(e,t){return function(r){return Rn(e,r,t)}}));function cc(e,t,r){var n=Ns(t),i=En(t,n);null!=r||ts(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=En(t,Ns(t)));var o=!(ts(r)&&"chain"in r&&!r.chain),a=Qa(e);return Mt(i,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ii(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,jt([this.value()],arguments))})})),e}function uc(){}var fc=Hi(Tt),dc=Hi(It),lc=Hi(Bt);function hc(e){return _o(e)?Jt(Bo(e)):function(e){return function(t){return Sn(t,e)}}(e)}var pc=Ji(),mc=Ji(!0);function gc(){return[]}function yc(){return!1}var bc=qi((function(e,t){return e+t}),0),vc=Vi("ceil"),wc=qi((function(e,t){return e/t}),1),Ac=Vi("floor");var _c,Ec=qi((function(e,t){return e*t}),1),Sc=Vi("round"),Pc=qi((function(e,t){return e-t}),0);return zr.after=function(e,t){if("function"!=typeof t)throw new Ie(n);return e=ms(e),function(){if(--e<1)return t.apply(this,arguments)}},zr.ary=Ma,zr.assign=ws,zr.assignIn=As,zr.assignInWith=_s,zr.assignWith=Es,zr.at=Ss,zr.before=Ca,zr.bind=Ia,zr.bindAll=ec,zr.bindKey=Ra,zr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ka(e)?e:[e]},zr.chain=ha,zr.chunk=function(e,t,n){t=(n?Ao(e,t,n):t===r)?1:br(ms(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=ae(mt(i/t));oo?0:o+n),(i=i===r||i>o?o:ms(i))<0&&(i+=o),i=n>i?0:gs(i);n>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=fi(t))&&ar(e)?_i(hr(e),0,n):e.split(t,n):[]},zr.spread=function(e,t){if("function"!=typeof e)throw new Ie(n);return t=null==t?0:br(ms(t),0),Xn((function(r){var n=r[t],i=_i(r,0,t);return n&&jt(i,n),xt(e,this,i)}))},zr.tail=function(e){var t=null==e?0:e.length;return t?ii(e,1,t):[]},zr.take=function(e,t,n){return e&&e.length?ii(e,0,(t=n||t===r?1:ms(t))<0?0:t):[]},zr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ii(e,(t=i-(t=n||t===r?1:ms(t)))<0?0:t,i):[]},zr.takeRightWhile=function(e,t){return e&&e.length?pi(e,uo(t,3),!1,!0):[]},zr.takeWhile=function(e,t){return e&&e.length?pi(e,uo(t,3)):[]},zr.tap=function(e,t){return t(e),e},zr.throttle=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw new Ie(n);return ts(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Na(e,t,{leading:i,maxWait:t,trailing:o})},zr.thru=pa,zr.toArray=hs,zr.toPairs=Fs,zr.toPairsIn=zs,zr.toPath=function(e){return Ka(e)?Tt(e,Bo):us(e)?[e]:Ii($o(vs(e)))},zr.toPlainObject=bs,zr.transform=function(e,t,r){var n=Ka(e),i=n||Va(e)||fs(e);if(t=uo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:ts(e)&&Qa(o)?Ur(We(e)):{}}return(i?Mt:An)(e,(function(e,n,i){return t(r,e,n,i)})),r},zr.unary=function(e){return Ma(e,1)},zr.union=ra,zr.unionBy=na,zr.unionWith=ia,zr.uniq=function(e){return e&&e.length?di(e):[]},zr.uniqBy=function(e,t){return e&&e.length?di(e,uo(t,2)):[]},zr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?di(e,r,t):[]},zr.unset=function(e,t){return null==e||li(e,t)},zr.unzip=oa,zr.unzipWith=aa,zr.update=function(e,t,r){return null==e?e:hi(e,t,vi(r))},zr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:hi(e,t,vi(n),i)},zr.values=Us,zr.valuesIn=function(e){return null==e?[]:Yt(e,Os(e))},zr.without=sa,zr.words=Qs,zr.wrap=function(e,t){return Ba(vi(t),e)},zr.xor=ca,zr.xorBy=ua,zr.xorWith=fa,zr.zip=da,zr.zipObject=function(e,t){return yi(e||[],t||[],tn)},zr.zipObjectDeep=function(e,t){return yi(e||[],t||[],ei)},zr.zipWith=la,zr.entries=Fs,zr.entriesIn=zs,zr.extend=As,zr.extendWith=_s,cc(zr,zr),zr.add=bc,zr.attempt=Ys,zr.camelCase=Ls,zr.capitalize=qs,zr.ceil=vc,zr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ys(n))==n?n:0),t!==r&&(t=(t=ys(t))==t?t:0),cn(ys(e),t,n)},zr.clone=function(e){return un(e,4)},zr.cloneDeep=function(e){return un(e,5)},zr.cloneDeepWith=function(e,t){return un(e,5,t="function"==typeof t?t:r)},zr.cloneWith=function(e,t){return un(e,4,t="function"==typeof t?t:r)},zr.conformsTo=function(e,t){return null==t||fn(e,t,Ns(t))},zr.deburr=Hs,zr.defaultTo=function(e,t){return null==e||e!=e?t:e},zr.divide=wc,zr.endsWith=function(e,t,n){e=vs(e),t=fi(t);var i=e.length,o=n=n===r?i:cn(ms(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},zr.eq=Ua,zr.escape=function(e){return(e=vs(e))&&Z.test(e)?e.replace(G,ir):e},zr.escapeRegExp=function(e){return(e=vs(e))&&ie.test(e)?e.replace(ne,"\\$&"):e},zr.every=function(e,t,n){var i=Ka(e)?It:mn;return n&&Ao(e,t,n)&&(t=r),i(e,uo(t,3))},zr.find=ya,zr.findIndex=Ho,zr.findKey=function(e,t){return zt(e,uo(t,3),An)},zr.findLast=ba,zr.findLastIndex=Ko,zr.findLastKey=function(e,t){return zt(e,uo(t,3),_n)},zr.floor=Ac,zr.forEach=va,zr.forEachRight=wa,zr.forIn=function(e,t){return null==e?e:vn(e,uo(t,3),Os)},zr.forInRight=function(e,t){return null==e?e:wn(e,uo(t,3),Os)},zr.forOwn=function(e,t){return e&&An(e,uo(t,3))},zr.forOwnRight=function(e,t){return e&&_n(e,uo(t,3))},zr.get=ks,zr.gt=La,zr.gte=qa,zr.has=function(e,t){return null!=e&&yo(e,t,Mn)},zr.hasIn=Ms,zr.head=Wo,zr.identity=ic,zr.includes=function(e,t,r,n){e=Wa(e)?e:Us(e),r=r&&!n?ms(r):0;var i=e.length;return r<0&&(r=br(i+r,0)),cs(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Lt(e,t,r)>-1},zr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ms(r);return i<0&&(i=br(n+i,0)),Lt(e,t,i)},zr.inRange=function(e,t,n){return t=ps(t),n===r?(n=t,t=0):n=ps(n),function(e,t,r){return e>=vr(t,r)&&e=-9007199254740991&&e<=h},zr.isSet=ss,zr.isString=cs,zr.isSymbol=us,zr.isTypedArray=fs,zr.isUndefined=function(e){return e===r},zr.isWeakMap=function(e){return rs(e)&&go(e)==N},zr.isWeakSet=function(e){return rs(e)&&"[object WeakSet]"==xn(e)},zr.join=function(e,t){return null==e?"":Wt.call(e,t)},zr.kebabCase=Ks,zr.last=Xo,zr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=ms(n))<0?br(i+o,0):vr(o,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Ut(e,Ht,o,!0)},zr.lowerCase=Js,zr.lowerFirst=Ws,zr.lt=ds,zr.lte=ls,zr.max=function(e){return e&&e.length?gn(e,ic,kn):r},zr.maxBy=function(e,t){return e&&e.length?gn(e,uo(t,2),kn):r},zr.mean=function(e){return Kt(e,ic)},zr.meanBy=function(e,t){return Kt(e,uo(t,2))},zr.min=function(e){return e&&e.length?gn(e,ic,Fn):r},zr.minBy=function(e,t){return e&&e.length?gn(e,uo(t,2),Fn):r},zr.stubArray=gc,zr.stubFalse=yc,zr.stubObject=function(){return{}},zr.stubString=function(){return""},zr.stubTrue=function(){return!0},zr.multiply=Ec,zr.nth=function(e,t){return e&&e.length?Hn(e,ms(t)):r},zr.noConflict=function(){return pt._===this&&(pt._=Ue),this},zr.noop=uc,zr.now=ka,zr.pad=function(e,t,r){e=vs(e);var n=(t=ms(t))?lr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Ki(gt(i),r)+e+Ki(mt(i),r)},zr.padEnd=function(e,t,r){e=vs(e);var n=(t=ms(t))?lr(e):0;return t&&nt){var i=e;e=t,t=i}if(n||e%1||t%1){var o=_r();return vr(e+o*(t-e+ft("1e-"+((o+"").length-1))),t)}return Vn(e,t)},zr.reduce=function(e,t,r){var n=Ka(e)?Dt:Gt,i=arguments.length<3;return n(e,uo(t,4),r,i,hn)},zr.reduceRight=function(e,t,r){var n=Ka(e)?$t:Gt,i=arguments.length<3;return n(e,uo(t,4),r,i,pn)},zr.repeat=function(e,t,n){return t=(n?Ao(e,t,n):t===r)?1:ms(t),Zn(vs(e),t)},zr.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zr.result=function(e,t,n){var i=-1,o=(t=wi(t,e)).length;for(o||(o=1,e=r);++ih)return[];var r=m,n=vr(e,m);t=uo(t),e-=m;for(var i=Zt(n,t);++r=a)return e;var c=n-lr(i);if(c<1)return i;var u=s?_i(s,0,c).join(""):e.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),as(o)){if(e.slice(c).search(o)){var f,d=u;for(o.global||(o=Me(o.source,vs(pe.exec(o))+"g")),o.lastIndex=0;f=o.exec(d);)var l=f.index;u=u.slice(0,l===r?c:l)}}else if(e.indexOf(fi(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i},zr.unescape=function(e){return(e=vs(e))&&V.test(e)?e.replace(W,mr):e},zr.uniqueId=function(e){var t=++$e;return vs(e)+t},zr.upperCase=Zs,zr.upperFirst=Xs,zr.each=va,zr.eachRight=wa,zr.first=Wo,cc(zr,(_c={},An(zr,(function(e,t){De.call(zr.prototype,t)||(_c[t]=e)})),_c),{chain:!1}),zr.VERSION="4.17.21",Mt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){zr[e].placeholder=zr})),Mt(["drop","take"],(function(e,t){Hr.prototype[e]=function(n){n=n===r?1:br(ms(n),0);var i=this.__filtered__&&!t?new Hr(this):this.clone();return i.__filtered__?i.__takeCount__=vr(n,i.__takeCount__):i.__views__.push({size:vr(n,m),type:e+(i.__dir__<0?"Right":"")}),i},Hr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Mt(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Hr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),Mt(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Hr.prototype[e]=function(){return this[r](1).value()[0]}})),Mt(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Hr.prototype[e]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(ic)},Hr.prototype.find=function(e){return this.filter(e).head()},Hr.prototype.findLast=function(e){return this.reverse().find(e)},Hr.prototype.invokeMap=Xn((function(e,t){return"function"==typeof e?new Hr(this):this.map((function(r){return Rn(r,e,t)}))})),Hr.prototype.reject=function(e){return this.filter(Da(uo(e)))},Hr.prototype.slice=function(e,t){e=ms(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Hr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=ms(t))<0?n.dropRight(-t):n.take(t-e)),n)},Hr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hr.prototype.toArray=function(){return this.take(m)},An(Hr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=zr[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(zr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Hr,u=s[0],f=c||Ka(t),d=function(e){var t=o.apply(zr,jt([e],s));return i&&l?t[0]:t};f&&n&&"function"==typeof u&&1!=u.length&&(c=f=!1);var l=this.__chain__,h=!!this.__actions__.length,p=a&&!l,m=c&&!h;if(!a&&f){t=m?t:new Hr(this);var g=e.apply(t,s);return g.__actions__.push({func:pa,args:[d],thisArg:r}),new qr(g,l)}return p&&m?e.apply(this,s):(g=this.thru(d),p?i?g.value()[0]:g.value():g)})})),Mt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Re[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);zr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ka(i)?i:[],e)}return this[r]((function(r){return t.apply(Ka(r)?r:[],e)}))}})),An(Hr.prototype,(function(e,t){var r=zr[t];if(r){var n=r.name+"";De.call(Rr,n)||(Rr[n]=[]),Rr[n].push({name:t,func:r})}})),Rr[Ui(r,2).name]=[{name:"wrapper",func:r}],Hr.prototype.clone=function(){var e=new Hr(this.__wrapped__);return e.__actions__=Ii(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ii(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ii(this.__views__),e},Hr.prototype.reverse=function(){if(this.__filtered__){var e=new Hr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ka(e),n=t<0,i=r?e.length:0,o=function(e,t,r){var n=-1,i=r.length;for(;++n=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},zr.prototype.plant=function(e){for(var t,n=this;n instanceof Lr;){var i=zo(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},zr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hr){var t=e;return this.__actions__.length&&(t=new Hr(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:r}),new qr(t,this.__chain__)}return this.thru(ta)},zr.prototype.toJSON=zr.prototype.valueOf=zr.prototype.value=function(){return mi(this.__wrapped__,this.__actions__)},zr.prototype.first=zr.prototype.head,Qe&&(zr.prototype[Qe]=function(){return this}),zr}();gt?((gt.exports=gr)._=gr,mt._=gr):pt._=gr}).call(u)}(Xw,Xw.exports);var Qw=f(Xw.exports),Yw={id:"https://spec.openapis.org/oas/3.0/schema/2021-09-28",$schema:"http://json-schema.org/draft-04/schema#",description:"The description of OpenAPI v3.0.x documents, as defined by https://spec.openapis.org/oas/v3.0.3",type:"object",required:["openapi","info","paths"],properties:{openapi:{type:"string",pattern:"^3\\.0\\.\\d(-.+)?$"},info:{$ref:"#/definitions/Info"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},servers:{type:"array",items:{$ref:"#/definitions/Server"}},security:{type:"array",items:{$ref:"#/definitions/SecurityRequirement"}},tags:{type:"array",items:{$ref:"#/definitions/Tag"},uniqueItems:!0},paths:{$ref:"#/definitions/Paths"},components:{$ref:"#/definitions/Components"}},patternProperties:{"^x-":{}},additionalProperties:!1,definitions:{Reference:{type:"object",required:["$ref"],patternProperties:{"^\\$ref$":{type:"string",format:"uri-reference"}}},Info:{type:"object",required:["title","version"],properties:{title:{type:"string"},description:{type:"string"},termsOfService:{type:"string",format:"uri-reference"},contact:{$ref:"#/definitions/Contact"},license:{$ref:"#/definitions/License"},version:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},Contact:{type:"object",properties:{name:{type:"string"},url:{type:"string",format:"uri-reference"},email:{type:"string",format:"email"}},patternProperties:{"^x-":{}},additionalProperties:!1},License:{type:"object",required:["name"],properties:{name:{type:"string"},url:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},Server:{type:"object",required:["url"],properties:{url:{type:"string"},description:{type:"string"},variables:{type:"object",additionalProperties:{$ref:"#/definitions/ServerVariable"}}},patternProperties:{"^x-":{}},additionalProperties:!1},ServerVariable:{type:"object",required:["default"],properties:{enum:{type:"array",items:{type:"string"}},default:{type:"string"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},Components:{type:"object",properties:{schemas:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}}},responses:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Response"}]}}},parameters:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Parameter"}]}}},examples:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Example"}]}}},requestBodies:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/RequestBody"}]}}},headers:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Header"}]}}},securitySchemes:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/SecurityScheme"}]}}},links:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Link"}]}}},callbacks:{type:"object",patternProperties:{"^[a-zA-Z0-9\\.\\-_]+$":{oneOf:[{$ref:"#/definitions/Reference"},{$ref:"#/definitions/Callback"}]}}}},patternProperties:{"^x-":{}},additionalProperties:!1},Schema:{type:"object",properties:{title:{type:"string"},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{type:"integer",minimum:0},minLength:{type:"integer",minimum:0,default:0},pattern:{type:"string",format:"regex"},maxItems:{type:"integer",minimum:0},minItems:{type:"integer",minimum:0,default:0},uniqueItems:{type:"boolean",default:!1},maxProperties:{type:"integer",minimum:0},minProperties:{type:"integer",minimum:0,default:0},required:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},enum:{type:"array",items:{},minItems:1,uniqueItems:!1},type:{type:"string",enum:["array","boolean","integer","number","object","string"]},not:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},allOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},oneOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},anyOf:{type:"array",items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},items:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},properties:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]}},additionalProperties:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"},{type:"boolean"}],default:!0},description:{type:"string"},format:{type:"string"},default:{},nullable:{type:"boolean",default:!1},discriminator:{$ref:"#/definitions/Discriminator"},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},example:{},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},deprecated:{type:"boolean",default:!1},xml:{$ref:"#/definitions/XML"}},patternProperties:{"^x-":{}},additionalProperties:!1},Discriminator:{type:"object",required:["propertyName"],properties:{propertyName:{type:"string"},mapping:{type:"object",additionalProperties:{type:"string"}}}},XML:{type:"object",properties:{name:{type:"string"},namespace:{type:"string",format:"uri"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{}},additionalProperties:!1},Response:{type:"object",required:["description"],properties:{description:{type:"string"},headers:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Header"},{$ref:"#/definitions/Reference"}]}},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"}},links:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Link"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1},MediaType:{type:"object",properties:{schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}},encoding:{type:"object",additionalProperties:{$ref:"#/definitions/Encoding"}}},patternProperties:{"^x-":{}},additionalProperties:!1,allOf:[{$ref:"#/definitions/ExampleXORExamples"}]},Example:{type:"object",properties:{summary:{type:"string"},description:{type:"string"},value:{},externalValue:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},Header:{type:"object",properties:{description:{type:"string"},required:{type:"boolean",default:!1},deprecated:{type:"boolean",default:!1},allowEmptyValue:{type:"boolean",default:!1},style:{type:"string",enum:["simple"],default:"simple"},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1},schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"},minProperties:1,maxProperties:1},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1,allOf:[{$ref:"#/definitions/ExampleXORExamples"},{$ref:"#/definitions/SchemaXORContent"}]},Paths:{type:"object",patternProperties:{"^\\/":{$ref:"#/definitions/PathItem"},"^x-":{}},additionalProperties:!1},PathItem:{type:"object",properties:{$ref:{type:"string"},summary:{type:"string"},description:{type:"string"},servers:{type:"array",items:{$ref:"#/definitions/Server"}},parameters:{type:"array",items:{oneOf:[{$ref:"#/definitions/Parameter"},{$ref:"#/definitions/Reference"}]},uniqueItems:!0}},patternProperties:{"^(get|put|post|delete|options|head|patch|trace)$":{$ref:"#/definitions/Operation"},"^x-":{}},additionalProperties:!1},Operation:{type:"object",required:["responses"],properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"},operationId:{type:"string"},parameters:{type:"array",items:{oneOf:[{$ref:"#/definitions/Parameter"},{$ref:"#/definitions/Reference"}]},uniqueItems:!0},requestBody:{oneOf:[{$ref:"#/definitions/RequestBody"},{$ref:"#/definitions/Reference"}]},responses:{$ref:"#/definitions/Responses"},callbacks:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Callback"},{$ref:"#/definitions/Reference"}]}},deprecated:{type:"boolean",default:!1},security:{type:"array",items:{$ref:"#/definitions/SecurityRequirement"}},servers:{type:"array",items:{$ref:"#/definitions/Server"}}},patternProperties:{"^x-":{}},additionalProperties:!1},Responses:{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/Response"},{$ref:"#/definitions/Reference"}]}},patternProperties:{"^[1-5](?:\\d{2}|XX)$":{oneOf:[{$ref:"#/definitions/Response"},{$ref:"#/definitions/Reference"}]},"^x-":{}},minProperties:1,additionalProperties:!1},SecurityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"}}},Tag:{type:"object",required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/ExternalDocumentation"}},patternProperties:{"^x-":{}},additionalProperties:!1},ExternalDocumentation:{type:"object",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri-reference"}},patternProperties:{"^x-":{}},additionalProperties:!1},ExampleXORExamples:{description:"Example and examples are mutually exclusive",not:{required:["example","examples"]}},SchemaXORContent:{description:"Schema and content are mutually exclusive, at least one is required",not:{required:["schema","content"]},oneOf:[{required:["schema"]},{required:["content"],description:"Some properties are not allowed if content is present",allOf:[{not:{required:["style"]}},{not:{required:["explode"]}},{not:{required:["allowReserved"]}},{not:{required:["example"]}},{not:{required:["examples"]}}]}]},Parameter:{type:"object",properties:{name:{type:"string"},in:{type:"string"},description:{type:"string"},required:{type:"boolean",default:!1},deprecated:{type:"boolean",default:!1},allowEmptyValue:{type:"boolean",default:!1},style:{type:"string"},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1},schema:{oneOf:[{$ref:"#/definitions/Schema"},{$ref:"#/definitions/Reference"}]},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"},minProperties:1,maxProperties:1},example:{},examples:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Example"},{$ref:"#/definitions/Reference"}]}}},patternProperties:{"^x-":{}},additionalProperties:!1,required:["name","in"],allOf:[{$ref:"#/definitions/ExampleXORExamples"},{$ref:"#/definitions/SchemaXORContent"},{$ref:"#/definitions/ParameterLocation"}]},ParameterLocation:{description:"Parameter location",oneOf:[{description:"Parameter in path",required:["required"],properties:{in:{enum:["path"]},style:{enum:["matrix","label","simple"],default:"simple"},required:{enum:[!0]}}},{description:"Parameter in query",properties:{in:{enum:["query"]},style:{enum:["form","spaceDelimited","pipeDelimited","deepObject"],default:"form"}}},{description:"Parameter in header",properties:{in:{enum:["header"]},style:{enum:["simple"],default:"simple"}}},{description:"Parameter in cookie",properties:{in:{enum:["cookie"]},style:{enum:["form"],default:"form"}}}]},RequestBody:{type:"object",required:["content"],properties:{description:{type:"string"},content:{type:"object",additionalProperties:{$ref:"#/definitions/MediaType"}},required:{type:"boolean",default:!1}},patternProperties:{"^x-":{}},additionalProperties:!1},SecurityScheme:{oneOf:[{$ref:"#/definitions/APIKeySecurityScheme"},{$ref:"#/definitions/HTTPSecurityScheme"},{$ref:"#/definitions/OAuth2SecurityScheme"},{$ref:"#/definitions/OpenIdConnectSecurityScheme"}]},APIKeySecurityScheme:{type:"object",required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query","cookie"]},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},HTTPSecurityScheme:{type:"object",required:["scheme","type"],properties:{scheme:{type:"string"},bearerFormat:{type:"string"},description:{type:"string"},type:{type:"string",enum:["http"]}},patternProperties:{"^x-":{}},additionalProperties:!1,oneOf:[{description:"Bearer",properties:{scheme:{type:"string",pattern:"^[Bb][Ee][Aa][Rr][Ee][Rr]$"}}},{description:"Non Bearer",not:{required:["bearerFormat"]},properties:{scheme:{not:{type:"string",pattern:"^[Bb][Ee][Aa][Rr][Ee][Rr]$"}}}}]},OAuth2SecurityScheme:{type:"object",required:["type","flows"],properties:{type:{type:"string",enum:["oauth2"]},flows:{$ref:"#/definitions/OAuthFlows"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},OpenIdConnectSecurityScheme:{type:"object",required:["type","openIdConnectUrl"],properties:{type:{type:"string",enum:["openIdConnect"]},openIdConnectUrl:{type:"string",format:"uri-reference"},description:{type:"string"}},patternProperties:{"^x-":{}},additionalProperties:!1},OAuthFlows:{type:"object",properties:{implicit:{$ref:"#/definitions/ImplicitOAuthFlow"},password:{$ref:"#/definitions/PasswordOAuthFlow"},clientCredentials:{$ref:"#/definitions/ClientCredentialsFlow"},authorizationCode:{$ref:"#/definitions/AuthorizationCodeOAuthFlow"}},patternProperties:{"^x-":{}},additionalProperties:!1},ImplicitOAuthFlow:{type:"object",required:["authorizationUrl","scopes"],properties:{authorizationUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},PasswordOAuthFlow:{type:"object",required:["tokenUrl","scopes"],properties:{tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},ClientCredentialsFlow:{type:"object",required:["tokenUrl","scopes"],properties:{tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},AuthorizationCodeOAuthFlow:{type:"object",required:["authorizationUrl","tokenUrl","scopes"],properties:{authorizationUrl:{type:"string",format:"uri-reference"},tokenUrl:{type:"string",format:"uri-reference"},refreshUrl:{type:"string",format:"uri-reference"},scopes:{type:"object",additionalProperties:{type:"string"}}},patternProperties:{"^x-":{}},additionalProperties:!1},Link:{type:"object",properties:{operationId:{type:"string"},operationRef:{type:"string",format:"uri-reference"},parameters:{type:"object",additionalProperties:{}},requestBody:{},description:{type:"string"},server:{$ref:"#/definitions/Server"}},patternProperties:{"^x-":{}},additionalProperties:!1,not:{description:"Operation Id and Operation Ref are mutually exclusive",required:["operationId","operationRef"]}},Callback:{type:"object",additionalProperties:{$ref:"#/definitions/PathItem"},patternProperties:{"^x-":{}}},Encoding:{type:"object",properties:{contentType:{type:"string"},headers:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/Header"},{$ref:"#/definitions/Reference"}]}},style:{type:"string",enum:["form","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{type:"boolean",default:!1}},additionalProperties:!1}}};function eA(e){if(new Date(e).getTime()>0)return Number(e);throw new an(new Error("invalid timestamp"),["invalid timestamp"])}async function tA(e){const t=[],r=Object.keys(e);(r.length<10||r.length>11)&&t.push(new an(new Error("Invalid agreeemt: "+JSON.stringify(e,void 0,2)),["invalid format"]));for(const n of r){let r;switch(n){case"orig":case"dest":try{e[n]!==await ao(JSON.parse(e[n]),!0)&&t.push(new an(`[dataExchangeAgreeement.${n}] A valid stringified JWK must be provided. For uniqueness, JWK claims must be alphabetically sorted in the stringified JWK. You can use the parseJWK(jwk, true) for that purpose.\n${e[n]}`,["invalid key","invalid format"]))}catch(e){t.push(new an(`[dataExchangeAgreeement.${n}] A valid stringified JWK must be provided. For uniqueness, JWK claims must be alphabetically sorted in the stringified JWK. You can use the parseJWK(jwk, true) for that purpose.`,["invalid key","invalid format"]))}break;case"ledgerContractAddress":case"ledgerSignerAddress":try{r=qh(e[n]),e[n]!==r&&t.push(new an(`[dataExchangeAgreeement.${n}] Invalid EIP-55 address ${e[n]}. Did you mean ${r} instead?`,["invalid EIP-55 address","invalid format"]))}catch(r){t.push(new an(`[dataExchangeAgreeement.${n}] Invalid EIP-55 address ${e[n]}.`,["invalid EIP-55 address","invalid format"]))}break;case"pooToPorDelay":case"pooToPopDelay":case"pooToSecretDelay":try{e[n]!==eA(e[n])&&t.push(new an(`[dataExchangeAgreeement.${n}] < 0 or not a number`,["invalid timestamp","invalid format"]))}catch(e){t.push(new an(`[dataExchangeAgreeement.${n}] < 0 or not a number`,["invalid timestamp","invalid format"]))}break;case"hashAlg":tn.includes(e[n])||t.push(new an(`[dataExchangeAgreeement.${n}Invalid hash algorithm '${e[n]}'. It must be one of: ${tn.join(", ")}`,["invalid algorithm"]));break;case"encAlg":nn.includes(e[n])||t.push(new an(`[dataExchangeAgreeement.${n}Invalid encryption algorithm '${e[n]}'. It must be one of: ${nn.join(", ")}`,["invalid algorithm"]));break;case"signingAlg":rn.includes(e[n])||t.push(new an(`[dataExchangeAgreeement.${n}Invalid signing algorithm '${e[n]}'. It must be one of: ${rn.join(", ")}`,["invalid algorithm"]));break;case"schema":break;default:t.push(new an(new Error(`Property ${n} not allowed in dataAgreement`),["invalid format"]))}}return t}var rA=Object.freeze({__proto__:null,NonRepudiationDest:class{constructor(e,t,r){this.initialized=new Promise(((n,i)=>{this.asyncConstructor(e,t,r).then((()=>{n(!0)})).catch((e=>{i(e)}))}))}async asyncConstructor(e,t,r){const n=await tA(e);if(n.length>0){const e=[];let t=[];throw n.forEach((r=>{e.push(r.message),t=t.concat(r.nrErrors)})),t=[...new Set(t)],new an("Resource has not been validated:\n"+e.join("\n"),t)}this.agreement=e,this.jwkPairDest={privateJwk:t,publicJwk:JSON.parse(e.dest)},this.publicJwkOrig=JSON.parse(e.orig),await Yi(this.jwkPairDest.publicJwk,this.jwkPairDest.privateJwk),this.dltAgent=r;const i=await this.dltAgent.getContractAddress();if(this.agreement.ledgerContractAddress!==i)throw new Error(`Contract address ${i} does not meet agreed one ${this.agreement.ledgerContractAddress}`);this.block={}}async verifyPoO(e,t,r){await this.initialized;const i=n(await so(t,this.agreement.hashAlg),!0,!1),{payload:o}=await Zi(e),a={...this.agreement,cipherblockDgst:i,blockCommitment:o.exchange.blockCommitment,secretCommitment:o.exchange.secretCommitment},s={proofType:"PoO",iss:"orig",exchange:{...a,id:await Hh(a)}},c={timestamp:Date.now(),notBefore:"iat",notAfter:"iat",...r},u=await Jh(e,s,c);return this.block={jwe:t,poo:{jws:e,payload:u.payload}},this.exchange=u.payload.exchange,u}async generatePoR(){if(await this.initialized,void 0===this.exchange||void 0===this.block.poo)throw new Error("Before computing a PoR, you have first to receive a valid cipherblock with a PoO and validate the PoO");const e={proofType:"PoR",iss:"dest",exchange:this.exchange,poo:this.block.poo.jws};return this.block.por=await Kh(e,this.jwkPairDest.privateJwk),this.block.por}async verifyPoP(e,t){if(await this.initialized,void 0===this.exchange||void 0===this.block.por||void 0===this.block.poo)throw new Error("Cannot verify a PoP if not even a PoR have been created");const r={proofType:"PoP",iss:"orig",exchange:this.exchange,por:this.block.por.jws,secret:"",verificationCode:""},n={timestamp:Date.now(),notBefore:"iat",notAfter:1e3*this.block.poo.payload.iat+this.exchange.pooToPopDelay,...t},o=await Jh(e,r,n),s=JSON.parse(o.payload.secret);return this.block.secret={hex:a(i(s.k)),jwk:s},this.block.pop={jws:e,payload:o.payload},o}async getSecretFromLedger(){if(await this.initialized,void 0===this.exchange||void 0===this.block.poo||void 0===this.block.por)throw new Error("Cannot get secret if a PoR has not been sent before");const e=Date.now(),t=1e3*this.block.poo.payload.iat+this.agreement.pooToSecretDelay,r=Math.round((t-e)/1e3),{hex:n,iat:i}=await this.dltAgent.getSecretFromLedger(Xi(this.agreement.encAlg),this.agreement.ledgerSignerAddress,this.exchange.id,r);this.block.secret=await Qi(this.exchange.encAlg,n);try{no(1e3*i,1e3*this.block.por.payload.iat,1e3*this.block.poo.payload.iat+this.exchange.pooToSecretDelay)}catch(e){throw new an(`Although the secret has been obtained (and you could try to decrypt the cipherblock), it's been published later than agreed: ${new Date(1e3*i).toUTCString()} > ${new Date(1e3*this.block.poo.payload.iat+this.agreement.pooToSecretDelay).toUTCString()}`,["secret not published in time"])}return this.block.secret}async decrypt(){if(await this.initialized,void 0===this.exchange)throw new Error("No agreed exchange");if(void 0===this.block.secret?.jwk)throw new Error("Cannot decrypt without the secret");if(void 0===this.block.jwe)throw new Error("No cipherblock to decrypt");const e=(await Vi(this.block.jwe,this.block.secret.jwk)).plaintext;if(n(await so(e,this.agreement.hashAlg),!0,!1)!==this.exchange.blockCommitment)throw new Error("Decrypted block does not meet the committed one");return this.block.raw=e,e}async generateVerificationRequest(){if(await this.initialized,void 0===this.block.por||void 0===this.exchange)throw new Error("Before generating a VerificationRequest, you have first to hold a valid PoR for the exchange");return await Xh("dest",this.exchange.id,this.block.por.jws,this.jwkPairDest.privateJwk)}async generateDisputeRequest(){if(await this.initialized,void 0===this.block.por||void 0===this.block.jwe||void 0===this.exchange)throw new Error("Before generating a VerificationRequest, you have first to hold a valid PoR for the exchange and have received the cipherblock");const e={proofType:"request",iss:"dest",por:this.block.por.jws,type:"disputeRequest",cipherblock:this.block.jwe,iat:Math.floor(Date.now()/1e3),dataExchangeId:this.exchange.id},t=await Wi(this.jwkPairDest.privateJwk);try{return await new Hi(e).setProtectedHeader({alg:this.jwkPairDest.privateJwk.alg}).setIssuedAt(e.iat).sign(t)}catch(e){throw new an(e,["unexpected error"])}}},NonRepudiationOrig:class{constructor(e,t,r,n){this.jwkPairOrig={privateJwk:t,publicJwk:JSON.parse(e.orig)},this.publicJwkDest=JSON.parse(e.dest),this.block={raw:r},this.initialized=new Promise(((t,r)=>{this.init(e,n).then((()=>{t(!0)})).catch((e=>{r(e)}))}))}async init(e,t){const r=await tA(e);if(r.length>0){const e=[];let t=[];throw r.forEach((r=>{e.push(r.message),t=t.concat(r.nrErrors)})),t=[...new Set(t)],new an("Resource has not been validated:\n"+e.join("\n"),t)}this.agreement=e,await Yi(this.jwkPairOrig.publicJwk,this.jwkPairOrig.privateJwk);const i=await Qi(this.agreement.encAlg);this.block={...this.block,secret:i,jwe:await Gi(this.block.raw,i.jwk,this.agreement.encAlg)};const o=n(await so(this.block.jwe,this.agreement.hashAlg),!0,!1),a=n(await so(this.block.raw,this.agreement.hashAlg),!0,!1),c=n(await so(new Uint8Array(s(this.block.secret.hex)),this.agreement.hashAlg),!0,!1),u={...this.agreement,cipherblockDgst:o,blockCommitment:a,secretCommitment:c},f=await Hh(u);this.exchange={...u,id:f},await this._dltSetup(t)}async _dltSetup(e){this.dltAgent=e;const t=await this.dltAgent.getAddress();if(t!==this.exchange.ledgerSignerAddress)throw new Error(`ledgerSignerAddress: ${this.exchange.ledgerSignerAddress} does not meet the address ${t} derived from the provided private key`);const r=await this.dltAgent.getContractAddress();if(r!==oo(this.agreement.ledgerContractAddress,!0))throw new Error(`Contract address in use ${r} does not meet the agreed one ${this.agreement.ledgerContractAddress}`)}async generatePoO(){return await this.initialized,this.block.poo=await Kh({proofType:"PoO",iss:"orig",exchange:this.exchange},this.jwkPairOrig.privateJwk),this.block.poo}async verifyPoR(e,t){if(await this.initialized,void 0===this.block.poo)throw new Error("Cannot verify a PoR if not even a PoO have been created");const r={proofType:"PoR",iss:"dest",exchange:this.exchange,poo:this.block.poo.jws},n=1e3*this.block.poo.payload.iat,i={timestamp:Date.now(),notBefore:n,notAfter:n+this.exchange.pooToPorDelay,...t},o=await Jh(e,r,i);return this.block.por={jws:e,payload:o.payload},this.block.por}async generatePoP(){if(await this.initialized,void 0===this.block.por)throw new Error("Before computing a PoP, you have first to have received and verified the PoR");const e=await this.dltAgent.deploySecret(this.block.secret.hex,this.exchange.id),t={proofType:"PoP",iss:"orig",exchange:this.exchange,por:this.block.por.jws,secret:JSON.stringify(this.block.secret.jwk),verificationCode:e};return this.block.pop=await Kh(t,this.jwkPairOrig.privateJwk),this.block.pop}async generateVerificationRequest(){if(await this.initialized,void 0===this.block.por)throw new Error("Before generating a VerificationRequest, you have first to hold a valid PoR for the exchange");return await Xh("orig",this.exchange.id,this.block.por.jws,this.jwkPairOrig.privateJwk)}}});e.ConflictResolution=Qh,e.ENC_ALGS=nn,e.EthersIoAgentDest=ip,e.EthersIoAgentOrig=Rp,e.HASH_ALGS=tn,e.I3mServerWalletAgentDest=cp,e.I3mServerWalletAgentOrig=Op,e.I3mWalletAgentDest=ap,e.I3mWalletAgentOrig=Np,e.KEY_AGREEMENT_ALGS=on,e.NonRepudiationProtocol=rA,e.NrError=an,e.SIGNING_ALGS=rn,e.Signers=Tp,e.checkTimestamp=no,e.createProof=Kh,e.defaultDltConfig=Yh,e.exchangeId=Hh,e.generateKeys=async function(e,t,r){if(!rn.includes(e))throw new an(new RangeError(`Invalid signature algorithm '${e}''. Allowed algorithms are ${rn.toString()}`),["invalid algorithm"]);let o,a,u;switch(e){case"ES512":a="P-521",o=66;break;case"ES384":a="P-384",o=48;break;default:a="P-256",o=32}u=void 0!==t?"string"==typeof t?!0===r?i(t):new Uint8Array(s(t)):t:new Uint8Array(await c(o));const f=new sn("p"+a.substring(a.length-3)).keyFromPrivate(u),d=f.getPublic(),l=d.getX().toString("hex").padStart(2*o,"0"),h=d.getY().toString("hex").padStart(2*o,"0"),p=f.getPrivate("hex").padStart(2*o,"0"),m={kty:"EC",crv:a,x:n(s(l),!0,!1),y:n(s(h),!0,!1),d:n(s(p),!0,!1),alg:e},g={...m};return delete g.d,{publicJwk:g,privateJwk:m}},e.getDltAddress=function(e){const t=e.match(/^did:ethr:(\w+:)?(0x[0-9a-fA-F]{40}[0-9a-fA-F]{26}?)$/),r=null!==t?t[t.length-1]:e;try{return Mf(r)}catch(e){throw new an("no a DID or a valid public or private key",["invalid format"])}},e.importJwk=Wi,e.jsonSort=io,e.jweDecrypt=Vi,e.jweEncrypt=Gi,e.jwsDecode=Zi,e.oneTimeSecret=Qi,e.parseAddress=qh,e.parseHex=oo,e.parseJwk=ao,e.sha=so,e.validateDataExchange=async function(e){const t=[];try{const{id:r,...n}=e;r!==await Hh(n)&&t.push(new an("Invalid dataExchange id",["cannot verify","invalid format"]));const{blockCommitment:i,secretCommitment:o,cipherblockDgst:a,...s}=n,c=await tA(s);c.length>0&&c.forEach((e=>{t.push(e)}))}catch(e){t.push(new an("Invalid dataExchange",["cannot verify","invalid format"]))}return t},e.validateDataExchangeAgreement=tA,e.validateDataSharingAgreementSchema=async function(e){const t=[],r=new pw({strictSchema:!1,removeAdditional:"all"});r.addMetaSchema(Yw),Zw(r);const n=jp.schemas.DataSharingAgreement;try{const i=r.compile(n),o=Qw.cloneDeep(e);i(e)||null!==i.errors&&void 0!==i.errors&&i.errors.length>0&&i.errors.forEach((e=>{t.push(new an(`[${e.instancePath}] ${e.message??"unknown"}`,["invalid format"]))})),ro(o)!==ro(e)&&t.push(new an("Additional claims beyond the schema are not supported",["invalid format"]))}catch(e){t.push(new an(e,["invalid format"]))}return t},e.verifyKeyPair=Yi,e.verifyProof=Jh}));