1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78492,(e,t,r)=>{"use strict";var n=Object.prototype.hasOwnProperty,i="~";function s(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,n,s){if("function"!=typeof r)throw TypeError("The listener must be a function");var a=new o(r,n||e,s),u=i?i+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function l(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(i=!1)),l.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},l.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=Array(s);n<s;n++)o[n]=r[n].fn;return o},l.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,n,s,o){var a=i?i+e:e;if(!this._events[a])return!1;var u,l,c=this._events[a],f=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,n),!0;case 5:return c.fn.call(c.context,t,r,n,s),!0;case 6:return c.fn.call(c.context,t,r,n,s,o),!0}for(l=1,u=Array(f-1);l<f;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var h,d=c.length;for(l=0;l<d;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),f){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,r);break;case 4:c[l].fn.call(c[l].context,t,r,n);break;default:if(!u)for(h=1,u=Array(f-1);h<f;h++)u[h-1]=arguments[h];c[l].fn.apply(c[l].context,u)}}return!0},l.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},l.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},l.prototype.removeListener=function(e,t,r,n){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return u(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||n&&!o.once||r&&o.context!==r||u(this,s);else{for(var a=0,l=[],c=o.length;a<c;a++)(o[a].fn!==t||n&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[s]=1===l.length?l[0]:l:u(this,s)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&u(this,t)):(this._events=new s,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,t.exports=l},95932,87246,e=>{"use strict";var t=e.i(78492);let r=t.default;e.s(["default",0,r],95932),e.s(["EventEmitter",()=>t.default],87246)},80355,e=>{"use strict";var t=e.i(44314);t.SHA256;let r=t.sha256;t.SHA224,t.sha224,e.s(["sha256",0,r])},34582,(e,t,r)=>{"use strict";r.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},r.toByteArray=function(e){var t,r,n=l(e),o=n[0],a=n[1],u=new s((o+a)*3/4-a),c=0,f=a>0?o-4:o;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(function(e,t,r){for(var i,s=[],o=t;o<r;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&s.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/",a=0,u=o.length;a<u;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}i[45]=62,i[95]=63},38492,(e,t,r)=>{r.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,u=(1<<a)-1,l=u>>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=256*s+e[t+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),s-=l}return(d?-1:1)*o*Math.pow(2,s-n)},r.write=function(e,t,r,n,i,s){var o,a,u,l=8*s-i-1,c=(1<<l)-1,f=c>>1,h=5960464477539062e-23*(23===i),d=n?0:s-1,p=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+f>=1?t+=h/u:t+=h*Math.pow(2,1-f),t*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(t*u-1)*Math.pow(2,i),o+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;e[r+d]=255&o,d+=p,o/=256,l-=8);e[r+d-p]|=128*m}},43943,(e,t,r)=>{"use strict";let n=e.r(34582),i=e.r(38492),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);let r=0|p(n,i),s=o(r),u=s.write(n,i);return u!==r&&(s=s.slice(0,u)),s}if(ArrayBuffer.isView(e)){var s=e;if(N(s,Uint8Array)){let e=new Uint8Array(s);return h(e.buffer,e.byteOffset,e.byteLength)}return f(s)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(N(e,ArrayBuffer)||e&&N(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(N(e,SharedArrayBuffer)||e&&N(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return a.from(u,t,r);let l=function(e){if(a.isBuffer(e)){let t=0|d(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(l)return l;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),o(e<0?0:0|d(e))}function f(e){let t=e.length<0?0:0|d(e.length),r=o(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){let n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||N(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return C(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:C(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=j[e[n]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":var s,o,a;return s=this,o=t,a=r,0===o&&a===s.length?n.fromByteArray(s):n.fromByteArray(s.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){let n=e.slice(t,r),i="";for(let e=0;e<n.length-1;
vendor: 17,155 bytes, line 1
1e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let s,o=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;s<a;s++)if(l(e,s)===l(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===u)return n*o}else -1!==n&&(s-=s-n),n=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){let r=!0;for(let n=0;n<u;n++)if(l(e,s+n)!==l(t,n)){r=!1;break}if(r)return s}return -1}function v(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],s=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,u;switch(o){case 1:t<128&&(s=t);break;case 2:(192&(r=e[i+1]))==128&&(u=(31&t)<<6|63&r)>127&&(s=u);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(u=(15&t)<<12|(63&r)<<6|63&n)>2047&&(u<55296||u>57343)&&(s=u);break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&u<1114112&&(s=u)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}var s=n;let o=s.length;if(o<=4096)return String.fromCharCode.apply(String,s);let a="",u=0;for(;u<o;)a+=String.fromCharCode.apply(String,s.slice(u,u+=4096));return a}function w(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function _(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function x(e,t,r,n,i){T(t,n,i,e,r,7);let s=Number(t&BigInt(0xffffffff));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function k(e,t,r,n,i){T(t,n,i,e,r,7);let s=Number(t&BigInt(0xffffffff));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function S(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,s){return t*=1,r>>>=0,s||S(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,s){return t*=1,r>>>=0,s||S(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}r.Buffer=a,r.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},r.INSPECT_MAX_BYTES=50,r.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(l(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(N(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),N(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){let r;if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;let n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(N(t,Uint8Array))i+t.length>n.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(a.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):m.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(N(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let s=i-n,o=r-t,u=Math.min(s,o),l=this.slice(n,i),c=e.slice(t,r);for(let e=0;e<u;++e)if(l[e]!==c[e]){s=l[e],o=c[e];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){var i,s,o,a,u,l,c,f;if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let d=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;let o=t.length;for(n>o/2&&(n=o/2),i=0;i<n;++i){var a;let n=parseInt(t.substr(2*i,2),16);if((a=n)!=a)break;e[r+i]=n}return i}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,L(C(e,this.length-i),this,i,s);case"ascii":case"latin1":case"binary":return o=t,a=r,L(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,o,a);case"base64":return u=t,l=r,L(U(e),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,f=r,L(function(e,t){let r,n,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,f);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=z(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&R(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+0x1000000*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+0x1000000*r;return BigInt(n)+(BigInt(i)<<BigInt(32))}),a.prototype.readBigUInt64BE=z(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&R(e,this.length-8);let n=0x1000000*t+65536*this[++e]+256*this[++e]+this[++e],i=0x1000000*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=z(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&R(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+0x1000000*this[++e])}),a.prototype.readBigInt64BE=z(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&R(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(0x1000000*this[++e]+65536*this[++e]+256*this[++e]+r)}),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;_(this,e,t,r,n,0)}let i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;_(this,e,t,r,n,0)}let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=z(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=z(function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){let n=Math.pow(2,8*r-1);_(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){let n=Math.pow(2,8*r-1);_(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=z(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=z(function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);let i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},a.prototype.fill=function(e,t,r,n){let i;if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){let t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{let s=a.isBuffer(e)?e:a.from(e,n),o=s.length;
1if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%o]}return this};let B={};function I(e,t,r){B[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function M(e){let t="",r=e.length,n=+("-"===e[0]);for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function T(e,t,r,n,i,s){if(e>r||e<t){let n,i="bigint"==typeof t?"n":"";throw n=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(s+1)*8}${i}`:`>= -(2${i} ** ${(s+1)*8-1}${i}) and < 2 ** ${(s+1)*8-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new B.ERR_OUT_OF_RANGE("value",n,e)}O(i,"offset"),(void 0===n[i]||void 0===n[i+s])&&R(i,n.length-(s+1))}function O(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function R(e,t,r){if(Math.floor(e)!==e)throw O(e,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${+!!r} and <= ${t}`,e)}I("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),I("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),I("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?i=M(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=M(i)),i+="n"),n+=` It must be ${t}. Received ${i}`},RangeError);let P=/[^+/0-9A-Za-z-_]/g;function C(e,t){let r;t=t||1/0;let n=e.length,i=null,s=[];for(let o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function L(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function N(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let j=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function z(e){return"undefined"==typeof BigInt?q:e}function q(){throw Error("BigInt not supported")}},50482,82563,37789,18744,67924,57615,42283,6452,31687,43778,2578,52474,55235,69620,31130,36480,14889,11220,75591,88916,44776,42449,39879,37904,72331,79821,26539,70948,10588,33795,14303,e=>{"use strict";let t;class r extends Error{name="BaseError";cause;constructor(e,t={}){super(e,t.cause?{cause:t.cause}:void 0),this.cause=t.cause}}e.s(["BaseError",()=>r],82563);class n extends r{name="AddMiniApp.InvalidDomainManifest";constructor(){super("Invalid domain manifest")}}class i extends r{name="AddMiniApp.RejectedByUser";constructor(){super("Add miniapp rejected by user")}}e.s(["InvalidDomainManifest",()=>n,"RejectedByUser",()=>i],37789),e.s([],18744),e.s([],67924),e.s([],57615),e.s(["DEFAULT_READY_OPTIONS",0,{disableNativeGestures:!1}],42283),e.s([],6452),e.s([],31687);class s extends r{name="SignIn.RejectedByUser";constructor(){super("Sign in rejected by user")}}e.s(["RejectedByUser",()=>s],43778);class o extends r{name="SignManifest.RejectedByUser";constructor(){super("Sign manifest rejected by user")}}class a extends r{name="SignManifest.InvalidDomain";constructor(){super("Invalid domain provided")}}class u extends r{name="SignManifest.GenericError";constructor(e="Manifest signing failed"){super(e)}}function l(e){return e.miniapp||e.frame}e.s(["GenericError",()=>u,"InvalidDomain",()=>a,"RejectedByUser",()=>o],2578),e.s([],52474),e.s([],55235),e.s([],69620),e.s([],31130),e.s([],50482),e.s(["DEFAULT_BACK_STATE",0,{visible:!1}],36480),e.s([],14889),e.s(["getMiniAppConfig",()=>l],11220),e.s([],67146),e.i(67146),(tm=tb||(tb={})).assertEqual=e=>{},tm.assertIs=function(e){},tm.assertNever=function(e){throw Error()},tm.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},tm.getValidEnumValues=e=>{let t=tm.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return tm.objectValues(r)},tm.objectValues=e=>tm.objectKeys(e).map(function(t){return e[t]}),tm.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},tm.find=(e,t)=>{for(let r of e)if(t(r))return r},tm.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,tm.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},tm.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(tv||(tv={})).mergeShapes=(e,t)=>({...e,...t});let c=tb.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),f=e=>{switch(typeof e){case"undefined":return c.undefined;case"string":return c.string;case"number":return Number.isNaN(e)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":if(Array.isArray(e))return c.array;if(null===e)return c.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return c.promise;if("undefined"!=typeof Map&&e instanceof Map)return c.map;if("undefined"!=typeof Set&&e instanceof Set)return c.set;if("undefined"!=typeof Date&&e instanceof Date)return c.date;return c.object;default:return c.unknown}};e.s(["ZodParsedType",0,c,"getParsedType",0,f,"objectUtil",()=>tv,"util",()=>tb],56307);
1let h=tb.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),d=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class p extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof p))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tb.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}p.create=e=>new p(e),e.s(["ZodError",()=>p,"ZodIssueCode",0,h,"quotelessJson",0,d],30700);let m=(e,t)=>{let r;switch(e.code){case h.invalid_type:r=e.received===c.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,tb.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${tb.joinValues(e.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${tb.joinValues(e.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${tb.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:tb.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case h.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=t.defaultError,tb.assertNever(e)}return{message:r}},g=m;function y(e){g=e}function b(){return g}e.s(["getErrorMap",()=>b,"setErrorMap",()=>y],51408),e.i(51408),e.s(["defaultErrorMap",0,m,"getErrorMap",()=>b,"setErrorMap",()=>y],77601),e.i(77601);let v=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],o={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let a="";for(let e of n.filter(e=>!!e).slice().reverse())a=e(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}},w=[];function _(e,t){let r=g,n=v({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===m?void 0:m].filter(e=>!!e)});e.common.issues.push(n)}class x{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return k;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return x.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return k;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let k=Object.freeze({status:"aborted"}),S=e=>({status:"dirty",value:e}),E=e=>
1({status:"valid",value:e}),A=e=>"aborted"===e.status,B=e=>"dirty"===e.status,I=e=>"valid"===e.status,M=e=>"undefined"!=typeof Promise&&e instanceof Promise;e.s(["DIRTY",0,S,"EMPTY_PATH",0,w,"INVALID",0,k,"OK",0,E,"ParseStatus",()=>x,"addIssueToContext",()=>_,"isAborted",0,A,"isAsync",0,M,"isDirty",0,B,"isValid",0,I,"makeIssue",0,v],92467),e.i(92467),e.s([],13530),e.i(13530),e.i(56307),(tg=tw||(tw={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},tg.toString=e=>"string"==typeof e?e:e?.message;class T{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let O=(e,t)=>{if(I(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new p(e.common.issues);return this._error=t,this._error}}};function R(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:s}=e;return"invalid_enum_value"===t.code?{message:s??i.defaultError}:void 0===i.data?{message:s??n??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:s??r??i.defaultError}},description:i}}class P{get description(){return this._def.description}_getType(e){return f(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:f(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new x,ctx:{common:e.parent.common,data:e.data,parsedType:f(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(M(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)},n=this._parseSync({data:e,path:r.path,parent:r});return O(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return I(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>I(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)},n=this._parse({data:e,path:r.path,parent:r});return O(r,await (M(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),s=()=>n.addIssue({code:h.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(s(),!1)):!!i||(s(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new eB({schema:this,typeName:t_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return eI.create(this,this._def)}nullable(){return eM.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ec.create(this)}promise(){return eA.create(this,this._def)}or(e){return eh.create([this,e],this._def)}and(e){return em.create(this,e,this._def)}transform(e){return new eB({...R(this._def),schema:this,typeName:t_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eT({...R(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:t_.ZodDefault})}brand(){return new eC({typeName:t_.ZodBranded,type:this,...R(this._def)})}catch(e){return new eO({...R(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:t_.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eU.create(this,e)}readonly(){return eL.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let C=/^c[^\s-]{8,}
vendor: 26,438 bytes, line 1
1$/i,U=/^[0-9a-z]+$/,L=/^[0-9A-HJKMNP-TV-Z]{26}$/i,N=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j=/^[a-z0-9_-]{21}$/i,z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,q=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,W=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,K=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,V=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,H="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",G=RegExp(`^${H}$`);function J(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Y(e){let t=`${H}T${J(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class X extends P{_parse(e){var r,n,i,s;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==c.string){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.string,received:t.parsedType}),k}let a=new x;for(let u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(_(o=this._getOrReturnCtx(e,o),{code:h.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),a.dirty());else if("max"===u.kind)e.data.length>u.value&&(_(o=this._getOrReturnCtx(e,o),{code:h.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),a.dirty());else if("length"===u.kind){let t=e.data.length>u.value,r=e.data.length<u.value;(t||r)&&(o=this._getOrReturnCtx(e,o),t?_(o,{code:h.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):r&&_(o,{code:h.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),a.dirty())}else if("email"===u.kind)Z.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"email",code:h.invalid_string,message:u.message}),a.dirty());else if("emoji"===u.kind)t||(t=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),t.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:h.invalid_string,message:u.message}),a.dirty());else if("uuid"===u.kind)N.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:h.invalid_string,message:u.message}),a.dirty());else if("nanoid"===u.kind)j.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"nanoid",code:h.invalid_string,message:u.message}),a.dirty());else if("cuid"===u.kind)C.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:h.invalid_string,message:u.message}),a.dirty());else if("cuid2"===u.kind)U.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:h.invalid_string,message:u.message}),a.dirty());else if("ulid"===u.kind)L.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:h.invalid_string,message:u.message}),a.dirty());else if("url"===u.kind)try{new URL(e.data)}catch{_(o=this._getOrReturnCtx(e,o),{validation:"url",code:h.invalid_string,message:u.message}),a.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"regex",code:h.invalid_string,message:u.message}),a.dirty())):"trim"===u.kind?e.data=e.data.trim():"includes"===u.kind?e.data.includes(u.value,u.position)||(_(o=this._getOrReturnCtx(e,o),{code:h.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),a.dirty()):"toLowerCase"===u.kind?e.data=e.data.toLowerCase():"toUpperCase"===u.kind?e.data=e.data.toUpperCase():"startsWith"===u.kind?e.data.startsWith(u.value)||(_(o=this._getOrReturnCtx(e,o),{code:h.invalid_string,validation:{startsWith:u.value},message:u.message}),a.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(_(o=this._getOrReturnCtx(e,o),{code:h.invalid_string,validation:{endsWith:u.value},message:u.message}),a.dirty()):"datetime"===u.kind?Y(u).test(e.data)||(_(o=this._getOrReturnCtx(e,o),{code:h.invalid_string,validation:"datetime",message:u.message}),a.dirty()):"date"===u.kind?G.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{code:h.invalid_string,validation:"date",message:u.message}),a.dirty()):"time"===u.kind?RegExp(`^${J(u)}$`).test(e.data)||(_(o=this._getOrReturnCtx(e,o),{code:h.invalid_string,validation:"time",message:u.message}),a.dirty()):"duration"===u.kind?q.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"duration",code:h.invalid_string,message:u.message}),a.dirty()):"ip"===u.kind?(r=e.data,!(("v4"===(n=u.version)||!n)&&F.test(r)||("v6"===n||!n)&&W.test(r))&&1&&(_(o=this._getOrReturnCtx(e,o),{validation:"ip",code:h.invalid_string,message:u.message}),a.dirty())):"jwt"===u.kind?!function(e,t){if(!z.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,u.alg)&&(_(o=this._getOrReturnCtx(e,o),{validation:"jwt",code:h.invalid_string,message:u.message}),a.dirty()):"cidr"===u.kind?(i=e.data,!(("v4"===(s=u.version)||!s)&&D.test(i)||("v6"===s||!s)&&$.test(i))&&1&&(_(o=this._getOrReturnCtx(e,o),{validation:"cidr",code:h.invalid_string,message:u.message}),a.dirty())):"base64"===u.kind?K.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"base64",code:h.invalid_string,message:u.message}),a.dirty()):"base64url"===u.kind?V.test(e.data)||(_(o=this._getOrReturnCtx(e,o),{validation:"base64url",code:h.invalid_string,message:u.message}),a.dirty()):tb.assertNever(u);return{status:a.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...tw.errToObj(r)})}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tw.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tw.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tw.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tw.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tw.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tw.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tw.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tw.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tw.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tw.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tw.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tw.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tw.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...tw.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...tw.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...tw.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tw.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...tw.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tw.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tw.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tw.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tw.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tw.errToObj(t)})}nonempty(e){return this.min(1,tw.errToObj(e))}trim(){return new X({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new X({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new X({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}X.create=e=>new X({checks:[],typeName:t_.ZodString,coerce:e?.coerce??!1,...R(e)});class Q extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==c.number){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.number,received:t.parsedType}),k}let r=new x;for(let n of this._def.checks)"int"===n.kind?tb.isInteger(e.data)||(_(t=this._getOrReturnCtx(e,t),{code:h.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,n.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(_(t=this._getOrReturnCtx(e,t),{code:h.not_finite,message:n.message}),r.dirty()):tb.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tw.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tw.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tw.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tw.toString(t))}setLimit(e,t,r,n){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tw.toString(n)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tw.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tw.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tw.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tw.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tw.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tw.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tw.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tw.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tw.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&tb.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}Q.create=e=>new Q({checks:[],typeName:t_.ZodNumber,coerce:e?.coerce||!1,...R(e)});class ee extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==c.bigint)return this._getInvalidInput(e);let r=new x;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(_(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):tb.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.bigint,received:t.parsedType}),k}gte(e,t){return this.setLimit("min",e,!0,tw.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tw.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tw.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tw.toString(t))}setLimit(e,t,r,n){return new ee({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tw.toString(n)}]})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tw.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tw.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tw.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tw.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tw.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ee.create=e=>new ee({checks:[],typeName:t_.ZodBigInt,coerce:e?.coerce??!1,...R(e)});class et extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==c.boolean){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.boolean,received:t.parsedType}),k}return E(e.data)}}et.create=e=>new et({typeName:t_.ZodBoolean,coerce:e?.coerce||!1,...R(e)});class er extends P{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==c.date){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.date,received:t.parsedType}),k}if(Number.isNaN(e.data.getTime()))return _(this._getOrReturnCtx(e),{code:h.invalid_date}),k;let r=new x;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):tb.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new er({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tw.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tw.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}er.create=e=>new er({checks:[],coerce:e?.coerce||!1,typeName:t_.ZodDate,...R(e)});class en extends P{_parse(e){if(this._getType(e)!==c.symbol){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.symbol,received:t.parsedType}),k}return E(e.data)}}en.create=e=>new en({typeName:t_.ZodSymbol,...R(e)});class ei extends P{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.undefined,received:t.parsedType}),k}return E(e.data)}}ei.create=e=>new ei({typeName:t_.ZodUndefined,...R(e)});class es extends P{_parse(e){if(this._getType(e)!==c.null){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.null,received:t.parsedType}),k}return E(e.data)}}es.create=e=>new es({typeName:t_.ZodNull,...R(e)});class eo extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return E(e.data)}}eo.create=e=>new eo({typeName:t_.ZodAny,...R(e)});class ea extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E(e.data)}}ea.create=e=>new ea({typeName:t_.ZodUnknown,...R(e)});class eu extends P{_parse(e){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.never,received:t.parsedType}),k}}eu.create=e=>new eu({typeName:t_.ZodNever,...R(e)});class el extends P{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.void,received:t.parsedType}),k}return E(e.data)}}el.create=e=>new el({typeName:t_.ZodVoid,...R(e)});class ec extends P{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==c.array)return _(t,{code:h.invalid_type,expected:c.array,received:t.parsedType}),k;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(_(t,{code:e?h.too_big:h.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(_(t,{code:h.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(_(t,{code:h.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new T(t,e,t.path,r)))).then(e=>x.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new T(t,e,t.path,r)));return x.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new ec({...this._def,minLength:{value:e,message:tw.toString(t)}})}max(e,t){return new ec({...this._def,maxLength:{value:e,message:tw.toString(t)}})}length(e,t){return new ec({...this._def,exactLength:{value:e,message:tw.toString(t)}})}nonempty(e){return this.min(1,e)}}ec.create=(e,t)=>new ec({type:e,minLength:null,maxLength:null,exactLength:null,typeName:t_.ZodArray,...R(t)});class ef extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=tb.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.object){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),k}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof eu&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||s.push(e);let o=[];for(let e of i){let t=n[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new T(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof eu){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(_(r,{code:h.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new T(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>x.mergeObjectSync(t,e)):x.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return tw.errToObj,new ef({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:tw.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new ef({...this._def,unknownKeys:"strip"})}passthrough(){return new ef({...this._def,unknownKeys:"passthrough"})}extend(e){return new ef({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ef({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:t_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ef({...this._def,catchall:e})}pick(e){let t={};for(let r of tb.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ef({...this._def,shape:()=>t})}omit(e){let t={};for(let r of tb.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ef({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ef){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=eI.create(e(i))}return new ef({...t._def,shape:()=>r})}if(t instanceof ec)return new ec({...t._def,type:e(t.element)});if(t instanceof eI)return eI.create(e(t.unwrap()));if(t instanceof eM)return eM.create(e(t.unwrap()));if(t instanceof eg)return eg.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of tb.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new ef({...this._def,shape:()=>t})}required(e){let t={};for(let r of tb.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eI;)e=e._def.innerType;t[r]=e}return new ef({...this._def,shape:()=>t})}keyof(){return ek(tb.objectKeys(this.shape))}}ef.create=(e,t)=>new ef({shape:()=>e,unknownKeys:"strip",catchall:eu.create(),typeName:t_.ZodObject,...R(t)}),ef.strictCreate=(e,t)=>new ef({shape:()=>e,unknownKeys:"strict",catchall:eu.create(),typeName:t_.ZodObject,...R(t)}),ef.lazycreate=(e,t)=>new ef({shape:e,unknownKeys:"strip",catchall:eu.create(),typeName:t_.ZodObject,...R(t)});class eh extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new p(e.ctx.common.issues));return _(t,{code:h.invalid_union,unionErrors:r}),k});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new p(e));return _(t,{code:h.invalid_union,unionErrors:i}),k}}get options(){return this._def.options}}eh.create=(e,t)=>
1new eh({options:e,typeName:t_.ZodUnion,...R(t)});let ed=e=>{if(e instanceof e_)return ed(e.schema);if(e instanceof eB)return ed(e.innerType());if(e instanceof ex)return[e.value];if(e instanceof eS)return e.options;if(e instanceof eE)return tb.objectValues(e.enum);else if(e instanceof eT)return ed(e._def.innerType);else if(e instanceof ei)return[void 0];else if(e instanceof es)return[null];else if(e instanceof eI)return[void 0,...ed(e.unwrap())];else if(e instanceof eM)return[null,...ed(e.unwrap())];else if(e instanceof eC)return ed(e.unwrap());else if(e instanceof eL)return ed(e.unwrap());else if(e instanceof eO)return ed(e._def.innerType);else return[]};class ep extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.object)return _(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),k;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(_(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=ed(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new ep({typeName:t_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...R(r)})}}class em extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(A(e)||A(n))return k;let i=function e(t,r){let n=f(t),i=f(r);if(t===r)return{valid:!0,data:t};if(n===c.object&&i===c.object){let n=tb.objectKeys(r),i=tb.objectKeys(t).filter(e=>-1!==n.indexOf(e)),s={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};s[n]=i.data}return{valid:!0,data:s}}if(n===c.array&&i===c.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=e(t[i],r[i]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}if(n===c.date&&i===c.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?((B(e)||B(n))&&t.dirty(),{status:t.value,value:i.data}):(_(r,{code:h.invalid_intersection_types}),k)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}em.create=(e,t,r)=>new em({left:e,right:t,typeName:t_.ZodIntersection,...R(r)});class eg extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.array)return _(r,{code:h.invalid_type,expected:c.array,received:r.parsedType}),k;if(r.data.length<this._def.items.length)return _(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new T(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>x.mergeArray(t,e)):x.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new eg({...this._def,rest:e})}}eg.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new eg({items:e,typeName:t_.ZodTuple,rest:null,...R(t)})};class ey extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.object)return _(r,{code:h.invalid_type,expected:c.object,received:r.parsedType}),k;let n=[],i=this._def.keyType,s=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new T(r,e,r.path,e)),value:s._parse(new T(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?x.mergeObjectAsync(t,n):x.mergeObjectSync(t,n)}
1get element(){return this._def.valueType}static create(e,t,r){return new ey(t instanceof P?{keyType:e,valueType:t,typeName:t_.ZodRecord,...R(r)}:{keyType:X.create(),valueType:e,typeName:t_.ZodRecord,...R(t)})}}class eb extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.map)return _(r,{code:h.invalid_type,expected:c.map,received:r.parsedType}),k;let n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([e,t],s)=>({key:n._parse(new T(r,e,r.path,[s,"key"])),value:i._parse(new T(r,t,r.path,[s,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of s){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return k;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of s){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return k;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}eb.create=(e,t,r)=>new eb({valueType:t,keyType:e,typeName:t_.ZodMap,...R(r)});class ev extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.set)return _(r,{code:h.invalid_type,expected:c.set,received:r.parsedType}),k;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(_(r,{code:h.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(_(r,{code:h.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function s(e){let r=new Set;for(let n of e){if("aborted"===n.status)return k;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new T(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>s(e)):s(o)}min(e,t){return new ev({...this._def,minSize:{value:e,message:tw.toString(t)}})}max(e,t){return new ev({...this._def,maxSize:{value:e,message:tw.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ev.create=(e,t)=>new ev({valueType:e,minSize:null,maxSize:null,typeName:t_.ZodSet,...R(t)});class ew extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.function)return _(t,{code:h.invalid_type,expected:c.function,received:t.parsedType}),k;function r(e,r){return v({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,g,m].filter(e=>!!e),issueData:{code:h.invalid_arguments,argumentsError:r}})}function n(e,r){return v({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,g,m].filter(e=>!!e),issueData:{code:h.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof eA){let e=this;return E(async function(...t){let o=new p([]),a=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),u=await Reflect.apply(s,this,a);return await e._def.returns._def.type.parseAsync(u,i).catch(e=>{throw o.addIssue(n(u,e)),o})})}{let e=this;return E(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new p([r(t,o.error)]);let a=Reflect.apply(s,this,o.data),u=e._def.returns.safeParse(a,i);if(!u.success)throw new p([n(a,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ew({...this._def,args:eg.create(e).rest(ea.create())})}returns(e){return new ew({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ew({args:e||eg.create([]).rest(ea.create()),returns:t||ea.create(),typeName:t_.ZodFunction,...R(r)})}}class e_ extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}e_.create=(e,t)=>
1new e_({getter:e,typeName:t_.ZodLazy,...R(t)});class ex extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ek(e,t){return new eS({values:e,typeName:t_.ZodEnum,...R(t)})}ex.create=(e,t)=>new ex({value:e,typeName:t_.ZodLiteral,...R(t)});class eS extends P{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{expected:tb.joinValues(r),received:t.parsedType,code:h.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{received:t.data,code:h.invalid_enum_value,options:r}),k}return E(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return eS.create(e,{...this._def,...t})}exclude(e,t=this._def){return eS.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}eS.create=ek;class eE extends P{_parse(e){let t=tb.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==c.string&&r.parsedType!==c.number){let e=tb.objectValues(t);return _(r,{expected:tb.joinValues(e),received:r.parsedType,code:h.invalid_type}),k}if(this._cache||(this._cache=new Set(tb.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=tb.objectValues(t);return _(r,{received:r.data,code:h.invalid_enum_value,options:e}),k}return E(e.data)}get enum(){return this._def.values}}eE.create=(e,t)=>new eE({values:e,typeName:t_.ZodNativeEnum,...R(t)});class eA extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==c.promise&&!1===t.common.async?(_(t,{code:h.invalid_type,expected:c.promise,received:t.parsedType}),k):E((t.parsedType===c.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eA.create=(e,t)=>new eA({type:e,typeName:t_.ZodPromise,...R(t)});class eB extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===t_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{_(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return k;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?k:"dirty"===n.status||"dirty"===t.value?S(n.value):n});{if("aborted"===t.value)return k;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?k:"dirty"===n.status||"dirty"===t.value?S(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?k:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?k:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>I(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):k);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!I(e))return k;let s=n.transform(e.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}tb.assertNever(n)}}eB.create=(e,t,r)=>new eB({schema:e,typeName:t_.ZodEffects,effect:t,...R(r)}),eB.createWithPreprocess=(e,t,r)=>new eB({schema:t,effect:{type:"preprocess",transform:e},typeName:t_.ZodEffects,...R(r)});class eI extends P{_parse(e){return this._getType(e)===c.undefined?E(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eI.create=(e,t)=>
1new eI({innerType:e,typeName:t_.ZodOptional,...R(t)});class eM extends P{_parse(e){return this._getType(e)===c.null?E(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eM.create=(e,t)=>new eM({innerType:e,typeName:t_.ZodNullable,...R(t)});class eT extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===c.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eT.create=(e,t)=>new eT({innerType:e,typeName:t_.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...R(t)});class eO extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return M(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new p(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new p(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eO.create=(e,t)=>new eO({innerType:e,typeName:t_.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...R(t)});class eR extends P{_parse(e){if(this._getType(e)!==c.nan){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.nan,received:t.parsedType}),k}return{status:"valid",value:e.data}}}eR.create=e=>new eR({typeName:t_.ZodNaN,...R(e)});let eP=Symbol("zod_brand");class eC extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eU extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?k:"dirty"===e.status?(t.dirty(),S(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?k:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eU({in:e,out:t,typeName:t_.ZodPipeline})}}class eL extends P{_parse(e){let t=this._def.innerType._parse(e),r=e=>(I(e)&&(e.value=Object.freeze(e.value)),e);return M(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function eN(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function ej(e,t={},r){return e?eo.create().superRefine((n,i)=>{let s=e(n);if(s instanceof Promise)return s.then(e=>{if(!e){let e=eN(t,n),s=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:s})}});if(!s){let e=eN(t,n),s=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:s})}}):eo.create()}eL.create=(e,t)=>new eL({innerType:e,typeName:t_.ZodReadonly,...R(t)});let ez={object:ef.lazycreate};(ty=t_||(t_={})).ZodString="ZodString",ty.ZodNumber="ZodNumber",ty.ZodNaN="ZodNaN",ty.ZodBigInt="ZodBigInt",ty.ZodBoolean="ZodBoolean",ty.ZodDate="ZodDate",ty.ZodSymbol="ZodSymbol",ty.ZodUndefined="ZodUndefined",ty.ZodNull="ZodNull",ty.ZodAny="ZodAny",ty.ZodUnknown="ZodUnknown",ty.ZodNever="ZodNever",ty.ZodVoid="ZodVoid",ty.ZodArray="ZodArray",ty.ZodObject="ZodObject",ty.ZodUnion="ZodUnion",ty.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ty.ZodIntersection="ZodIntersection",ty.ZodTuple="ZodTuple",ty.ZodRecord="ZodRecord",ty.ZodMap="ZodMap",ty.ZodSet="ZodSet",ty.ZodFunction="ZodFunction",ty.ZodLazy="ZodLazy",ty.ZodLiteral="ZodLiteral",ty.ZodEnum="ZodEnum",ty.ZodEffects="ZodEffects",ty.ZodNativeEnum="ZodNativeEnum",ty.ZodOptional="ZodOptional",ty.ZodNullable="ZodNullable",ty.ZodDefault="ZodDefault",ty.ZodCatch="ZodCatch",ty.ZodPromise="ZodPromise",ty.ZodBranded="ZodBranded",ty.ZodPipeline="ZodPipeline",ty.ZodReadonly="ZodReadonly";let eq=(e,t={message:`Input not instance of ${e.name}`})=>ej(t=>t instanceof e,t),eZ=X.create,eF=Q.create,eD=eR.create,eW=ee.create,e$=et.create,eK=er.create,eV=en.create,eH=ei.create,eG=es.create,eJ=eo.create,eY=ea.create,eX=eu.create,eQ=el.create,e0=ec.create,e1=ef.create,e2=ef.strictCreate,e6=eh.create,e3=ep.create,e5=em.create,e8=eg.create,e4=ey.create,e9=eb.create,e7=ev.create,te=ew.create,tt=e_.create,tr=ex.create,tn=eS.create,ti=eE.create,ts=eA.create,to=eB.create,ta=eI.create,tu=eM.create,tl=eB.createWithPreprocess,tc=eU.create,tf=()=>eZ().optional(),th=()=>eF().optional(),td=()=>e$().optional(),tp={string:e=>X.create({...e,coerce:!0}),number:e=>Q.create({...e,coerce:!0}),boolean:e=>et.create({...e,coerce:!0}),bigint:e=>ee.create({...e,coerce:!0}),date:e=>er.create({...e,coerce:!0})};e.s(["BRAND",0,eP,"NEVER",0,k,"Schema",()=>P,"ZodAny",()=>eo,"ZodArray",()=>ec,"ZodBigInt",()=>
1ee,"ZodBoolean",()=>et,"ZodBranded",()=>eC,"ZodCatch",()=>eO,"ZodDate",()=>er,"ZodDefault",()=>eT,"ZodDiscriminatedUnion",()=>ep,"ZodEffects",()=>eB,"ZodEnum",()=>eS,"ZodFirstPartyTypeKind",()=>t_,"ZodFunction",()=>ew,"ZodIntersection",()=>em,"ZodLazy",()=>e_,"ZodLiteral",()=>ex,"ZodMap",()=>eb,"ZodNaN",()=>eR,"ZodNativeEnum",()=>eE,"ZodNever",()=>eu,"ZodNull",()=>es,"ZodNullable",()=>eM,"ZodNumber",()=>Q,"ZodObject",()=>ef,"ZodOptional",()=>eI,"ZodPipeline",()=>eU,"ZodPromise",()=>eA,"ZodReadonly",()=>eL,"ZodRecord",()=>ey,"ZodSchema",()=>P,"ZodSet",()=>ev,"ZodString",()=>X,"ZodSymbol",()=>en,"ZodTransformer",()=>eB,"ZodTuple",()=>eg,"ZodType",()=>P,"ZodUndefined",()=>ei,"ZodUnion",()=>eh,"ZodUnknown",()=>ea,"ZodVoid",()=>el,"any",()=>eJ,"array",()=>e0,"bigint",()=>eW,"boolean",()=>e$,"coerce",0,tp,"custom",()=>ej,"date",()=>eK,"datetimeRegex",()=>Y,"discriminatedUnion",()=>e3,"effect",()=>to,"enum",()=>tn,"function",()=>te,"instanceof",()=>eq,"intersection",()=>e5,"late",0,ez,"lazy",()=>tt,"literal",()=>tr,"map",()=>e9,"nan",()=>eD,"nativeEnum",()=>ti,"never",()=>eX,"null",()=>eG,"nullable",()=>tu,"number",()=>eF,"object",()=>e1,"oboolean",()=>td,"onumber",()=>th,"optional",()=>ta,"ostring",()=>tf,"pipeline",()=>tc,"preprocess",()=>tl,"promise",()=>ts,"record",()=>e4,"set",()=>e7,"strictObject",()=>e2,"string",()=>eZ,"symbol",()=>eV,"transformer",()=>to,"tuple",()=>e8,"undefined",()=>eH,"union",()=>e6,"unknown",()=>eY,"void",()=>eQ],59496),e.i(59496),e.i(30700),e.s(["BRAND",0,eP,"DIRTY",0,S,"EMPTY_PATH",0,w,"INVALID",0,k,"NEVER",0,k,"OK",0,E,"ParseStatus",()=>x,"Schema",()=>P,"ZodAny",()=>eo,"ZodArray",()=>ec,"ZodBigInt",()=>ee,"ZodBoolean",()=>et,"ZodBranded",()=>eC,"ZodCatch",()=>eO,"ZodDate",()=>er,"ZodDefault",()=>eT,"ZodDiscriminatedUnion",()=>ep,"ZodEffects",()=>eB,"ZodEnum",()=>eS,"ZodError",()=>p,"ZodFirstPartyTypeKind",()=>t_,"ZodFunction",()=>ew,"ZodIntersection",()=>em,"ZodIssueCode",0,h,"ZodLazy",()=>e_,"ZodLiteral",()=>ex,"ZodMap",()=>eb,"ZodNaN",()=>eR,"ZodNativeEnum",()=>eE,"ZodNever",()=>eu,"ZodNull",()=>es,"ZodNullable",()=>eM,"ZodNumber",()=>Q,"ZodObject",()=>ef,"ZodOptional",()=>eI,"ZodParsedType",0,c,"ZodPipeline",()=>eU,"ZodPromise",()=>eA,"ZodReadonly",()=>eL,"ZodRecord",()=>ey,"ZodSchema",()=>P,"ZodSet",()=>ev,"ZodString",()=>X,"ZodSymbol",()=>en,"ZodTransformer",()=>eB,"ZodTuple",()=>eg,"ZodType",()=>P,"ZodUndefined",()=>ei,"ZodUnion",()=>eh,"ZodUnknown",()=>ea,"ZodVoid",()=>el,"addIssueToContext",()=>_,"any",()=>eJ,"array",()=>e0,"bigint",()=>eW,"boolean",()=>e$,"coerce",0,tp,"custom",()=>ej,"date",()=>eK,"datetimeRegex",()=>Y,"defaultErrorMap",0,m,"discriminatedUnion",()=>e3,"effect",()=>to,"enum",()=>tn,"function",()=>te,"getErrorMap",()=>b,"getParsedType",0,f,"instanceof",()=>eq,"intersection",()=>e5,"isAborted",0,A,"isAsync",0,M,"isDirty",0,B,"isValid",0,I,"late",0,ez,"lazy",()=>tt,"literal",()=>tr,"makeIssue",0,v,"map",()=>e9,"nan",()=>eD,"nativeEnum",()=>ti,"never",()=>eX,"null",()=>eG,"nullable",()=>tu,"number",()=>eF,"object",()=>e1,"objectUtil",()=>tv,"oboolean",()=>td,"onumber",()=>th,"optional",()=>ta,"ostring",()=>tf,"pipeline",()=>tc,"preprocess",()=>tl,"promise",()=>ts,"quotelessJson",0,d,"record",()=>e4,"set",()=>e7,"setErrorMap",()=>y,"strictObject",()=>e2,"string",()=>eZ,"symbol",()=>eV,"transformer",()=>to,"tuple",()=>e8,"undefined",()=>eH,"union",()=>e6,"unknown",()=>eY,"util",()=>tb,"void",()=>eQ],89001);var tm,tg,ty,tb,tv,tw,t_,tx=e.i(89001),tx=tx,tx=tx;let tk=/[@#$%^&*+=/\\|~«»]/,tS=/(!{2,}|\?{2,}|-{2,})/,tE=/[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u,tA=({max:e,noSpaces:t}={})=>(t?tx.string().max(e??1/0).regex(/^\S*$/,"Spaces are not allowed"):tx.string().max(e??1/0)).refine(e=>!tE.test(e),{message:"Emojis and symbols are not allowed"}).refine(e=>!tk.test(e),{message:"Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed"}).refine(e=>!tS.test(e),{message:"Repeated punctuations (!!, ??, --) are not allowed"}),tB=tx.string().url().startsWith("https://",{message:"Must be an https url"}).max(1024).refine(e=>!e.includes(" "),{message:"URL must not contain spaces"}).refine(e=>{try{let t=new URL(e).hostname;if("localhost"===t||t.endsWith(".localhost")||/^(\d{1,3}\.){3}\d{1,3}$/.test(t)||t.startsWith("[")&&t.endsWith("]"))return!1;return!0}catch{return!1}},{message:"URL must not use IP addresses or localhost"}),tI=tx.string().max(32),tM=tx.string().max(32),tT=tx.string().regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/,{message:"Invalid CAIP-19 asset ID"}),tO=tx.string().regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i,{message:"Invalid hex color code. It should be in the format #RRGGBB or #RGB."}),tR=tx.string().max(1024).regex(/^(?!.*\.\.)([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,{message:"Must be a valid domain name (e.g., example.com, sub.example.com)"}).refine(e=>!e.includes("://"),{message:"Domain must not include protocol (http://, https://, etc.)"}).refine(e=>!e.includes("/"),{message:"Domain must not include path separators"}).refine(e=>!e.includes("@"),{message:"Domain must not include @ symbol"}).refine(e=>!e.includes(":"),{message:"Domain must not include port numbers"}),tP=tx.union([tx.literal("1:1"),tx.literal("3:2")]),tC=tx.object({header:tx.string(),payload:tx.string(),signature:tx.string()}
1),tU=tx.object({fid:tx.number(),type:tx.literal("app_key"),key:tx.string().startsWith("0x")});e.s(["aspectRatioSchema",0,tP,"buttonTitleSchema",0,tM,"caip19TokenSchema",0,tT,"createSimpleStringSchema",0,tA,"domainSchema",0,tR,"encodedJsonFarcasterSignatureSchema",0,tC,"hexColorSchema",0,tO,"jsonFarcasterSignatureHeaderSchema",0,tU,"miniAppNameSchema",0,tI,"secureUrlSchema",0,tB],75591);let tL=tx.object({type:tx.literal("launch_frame"),name:tI,url:tB.optional(),splashImageUrl:tB.optional(),splashBackgroundColor:tO.optional()}),tN=tx.object({type:tx.literal("launch_miniapp"),name:tI,url:tB.optional(),splashImageUrl:tB.optional(),splashBackgroundColor:tO.optional()}),tj=tx.object({type:tx.literal("view_token"),token:tT}),tz=tx.discriminatedUnion("type",[tN,tj,tL]),tq=tx.object({title:tM,action:tz}),tZ=tx.object({version:tx.union([tx.string(),tx.number()]).transform(e=>String(e)).pipe(tx.union([tx.literal("next"),tx.literal("1")])),imageUrl:tB,aspectRatio:tP.optional(),button:tq}),tF=e=>tZ.safeParse(e);e.s(["actionLaunchFrameSchema",0,tL,"actionLaunchMiniAppSchema",0,tN,"actionSchema",0,tz,"actionViewTokenSchema",0,tj,"buttonSchema",0,tq,"miniAppEmbedNextSchema",0,tZ,"safeParseFrameEmbed",0,tF,"safeParseMiniAppEmbed",0,tF],88916);var tx=tx,tx=tx;let tD=tx.object({url:tx.string(),token:tx.string()}),tW=tx.object({notificationId:tx.string().max(128),title:tx.string().max(32),body:tx.string().max(128),targetUrl:tB,tokens:tx.string().array().max(100)}),t$=tx.object({result:tx.object({successfulTokens:tx.array(tx.string()),invalidTokens:tx.array(tx.string()),rateLimitedTokens:tx.array(tx.string())})});e.s(["notificationDetailsSchema",0,tD,"sendNotificationRequestSchema",0,tW,"sendNotificationResponseSchema",0,t$],44776);let tK=tx.object({event:tx.literal("miniapp_added"),notificationDetails:tD.optional()}),tV=tx.object({event:tx.literal("miniapp_removed")}),tH=tx.object({event:tx.literal("notifications_enabled"),notificationDetails:tD.required()}),tG=tx.object({event:tx.literal("notifications_disabled")}),tJ=tx.discriminatedUnion("event",[tK,tV,tH,tG]);e.s(["eventMiniAppAddedSchema",0,tK,"eventMiniAppRemovedSchema",0,tV,"eventNotificationsEnabledSchema",0,tH,"notificationsDisabledSchema",0,tG,"serverEventSchema",0,tJ],42449);var tx=tx;e.s([],39879);let tY=["wallet.getEthereumProvider","wallet.getSolanaProvider","actions.ready","actions.openUrl","actions.close","actions.setPrimaryButton","actions.addMiniApp","actions.signIn","actions.viewCast","actions.viewProfile","actions.composeCast","actions.viewToken","actions.sendToken","actions.swapToken","actions.openMiniApp","actions.requestCameraAndMicrophoneAccess","experimental.signManifest","haptics.impactOccurred","haptics.notificationOccurred","haptics.selectionChanged","back"];e.s(["miniAppHostCapabilityList",0,tY],37904);let tX=["games","social","finance","utility","productivity","health-fitness","news-media","music","shopping","education","developer-tools","entertainment","art-creativity"],tQ=tx.enum(tX),t0=tx.union([tx.literal("0.0.0"),tx.literal("0.0.1"),tx.literal("1"),tx.literal("next")]),t1=tA({max:30}),t2=tA({max:170}),t6=tx.array(tB).max(3),t3=tx.array(tA({max:20,noSpaces:!0})).max(5),t5=tA({max:30}),t8=tA({max:30}),t4=tA({max:100}),t9=tx.boolean(),t7=["eip155:1","eip155:8453","eip155:42161","eip155:421614","eip155:84532","eip155:666666666","eip155:100","eip155:10","eip155:11155420","eip155:137","eip155:11155111","eip155:7777777","eip155:130","eip155:10143","eip155:42220","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"];function re(e){return Array.from(new Set(e))}let rt=tx.array(tx.enum(t7)).transform(re),rr=tx.array(tx.enum(tY)).transform(re),rn=tx.object({version:t0,name:tI,iconUrl:tB,homeUrl:tB,imageUrl:tB.optional(),buttonTitle:tM.optional(),splashImageUrl:tB.optional(),splashBackgroundColor:tO.optional(),webhookUrl:tB.optional(),subtitle:t1.optional(),description:t2.optional(),screenshotUrls:t6.optional(),primaryCategory:tQ.optional(),tags:t3.optional(),heroImageUrl:tB.optional(),tagline:t5.optional(),ogTitle:t8.optional(),ogDescription:t4.optional(),ogImageUrl:tB.optional(),noindex:t9.optional(),requiredChains:rt.optional(),requiredCapabilities:rr.optional(),castShareUrl:tB.optional(),canonicalDomain:tR.optional()}).refine(e=>{if(void 0===e.castShareUrl)return!0;try{let t=new URL(e.homeUrl).hostname,r=new URL(e.castShareUrl).hostname;return t===r}catch{return!1}},{message:"castShareUrl must have the same domain as homeUrl",path:["castShareUrl"]}),ri=tx.object({accountAssociation:tC,miniapp:rn.optional(),frame:rn.optional()}).refine(e=>!e.frame||!e.miniapp||JSON.stringify(e.frame)===JSON.stringify(e.miniapp),{message:'If both "frame" and "miniapp" are provided, they must be identical',path:["frame","miniapp"]}).transform(e=>({...e,frame:e.frame??e.miniapp}));e.s(["chains",0,t7,"descriptionSchema",0,t2,"domainManifestSchema",0,ri,"domainMiniAppConfigSchema",0,rn,"noindexSchema",0,t9,"ogDescriptionSchema",0,t4,"ogTitleSchema",0,t8,"primaryCategories",0,tX,"primaryCategorySchema",0,tQ,"requiredCapabilitiesSchema",0,rr,"requiredChainsSchema",0,rt,"screenshotUrlsSchema",0,t6,"subtitleSchema",0,t1,"taglineSchema",0,t5,"tagsSchema",0,t3,"versionSchema",0,t0],72331),e.s([],79821);var rs=e.i(44314),ro=e.i(70525);let ra=BigInt(0),ru=BigInt(1);function rl(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}function rc(e,t=""){if("boolean"!=typeof e)throw Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e}function rf(e,t,r=""){let n=(0,ro.isBytes)(e),i=e?.length,s=void 0!==t;if(!n||s&&i!==t)throw Error((r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${t}`:"")+", got "+(n?`length=${i}`:`type=${typeof e}`));return e}function rh(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function rd(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?ra:BigInt("0x"+e)}function rp(e){return rd((0,ro.bytesToHex)(e))}function rm(e){return(0,ro.abytes)(e),rd((0,ro.bytesToHex)(Uint8Array.from(e).reverse()))}function rg(e,t){return(0,ro.hexToBytes)(e.toString(16).padStart(2*t,"0"))}function ry(e,t){return rg(e,t).reverse()}function rb(e){return(0,ro.hexToBytes)(rh(e))}function rv(e,t,r){let n;if("string"==typeof t)try{n=(0,ro.hexToBytes)(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if((0,ro.isBytes)(t))n=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(e+" of length "+r+" expected, got "+i);return n}function rw(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}function r_(e){return Uint8Array.from(e)}function rx(e){return Uint8Array.from(e,(t,r)=>{let n=t.charCodeAt(0);if(1!==t.length||n>
1127)throw Error(`string contains non-ASCII character "${e[r]}" with code ${n} at position ${r}`);return n})}let rk=e=>"bigint"==typeof e&&ra<=e;function rS(e,t,r){return rk(e)&&rk(t)&&rk(r)&&t<=e&&e<r}function rE(e,t,r,n){if(!rS(t,r,n))throw Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function rA(e){let t;for(t=0;e>ra;e>>=ru,t+=1);return t}function rB(e,t){return e>>BigInt(t)&ru}function rI(e,t,r){return e|(r?ru:ra)<<BigInt(t)}let rM=e=>(ru<<BigInt(e))-ru;function rT(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=e=>new Uint8Array(e),i=n(e),s=n(e),o=0,a=()=>{i.fill(1),s.fill(0),o=0},u=(...e)=>r(s,i,...e),l=(e=n(0))=>{(s=u(Uint8Array.of(0),e),i=u(),0!==e.length)&&(s=u(Uint8Array.of(1),e),i=u())},c=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(i=u()).slice();r.push(t),e+=i.length}return(0,ro.concatBytes)(...r)};return(e,t)=>{let r;for(a(),l(e);!(r=t(c()));)l();return a(),r}}let rO={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||(0,ro.isBytes)(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function rR(e,t,r={}){let n=(t,r,n)=>{let i=rO[r];if("function"!=typeof i)throw Error("invalid validator function");let s=e[t];if((!n||void 0!==s)&&!i(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))n(e,r,!1);for(let[e,t]of Object.entries(r))n(e,t,!0);return e}function rP(e){return"function"==typeof e&&Number.isSafeInteger(e.outputLen)}function rC(e,t,r={}){if(!e||"object"!=typeof e)throw Error("expected valid options object");function n(t,r,n){let i=e[t];if(n&&void 0===i)return;let s=typeof i;if(s!==r||null===i)throw Error(`param "${t}" is invalid: expected ${r}, got ${s}`)}Object.entries(t).forEach(([e,t])=>n(e,t,!1)),Object.entries(r).forEach(([e,t])=>n(e,t,!0))}let rU=()=>{throw Error("not implemented")};function rL(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(void 0!==i)return i;let s=e(r,...n);return t.set(r,s),s}}e.s(["_abool2",()=>rc,"_abytes2",()=>rf,"_validateObject",()=>rC,"aInRange",()=>rE,"abool",()=>rl,"asciiToBytes",()=>rx,"bitGet",()=>rB,"bitLen",()=>rA,"bitMask",0,rM,"bitSet",()=>rI,"bytesToNumberBE",()=>rp,"bytesToNumberLE",()=>rm,"copyBytes",()=>r_,"createHmacDrbg",()=>rT,"ensureBytes",()=>rv,"equalBytes",()=>rw,"hexToNumber",()=>rd,"inRange",()=>rS,"isHash",()=>rP,"memoized",()=>rL,"notImplemented",0,rU,"numberToBytesBE",()=>rg,"numberToBytesLE",()=>ry,"numberToHexUnpadded",()=>rh,"numberToVarBytesBE",()=>rb,"validateObject",()=>rR],26539);let rN=BigInt(0),rj=BigInt(1),rz=BigInt(2),rq=BigInt(3),rZ=BigInt(4),rF=BigInt(5),rD=BigInt(7),rW=BigInt(8),r$=BigInt(9),rK=BigInt(16);function rV(e,t){let r=e%t;return r>=rN?r:t+r}function rH(e,t,r){let n=e;for(;t-- >rN;)n*=n,n%=r;return n}function rG(e,t){if(e===rN)throw Error("invert: expected non-zero number");if(t<=rN)throw Error("invert: expected positive modulus, got "+t);let r=rV(e,t),n=t,i=rN,s=rj,o=rj,a=rN;for(;r!==rN;){let e=n/r,t=n%r,u=i-o*e,l=s-a*e;n=r,r=t,i=o,s=a,o=u,a=l}if(n!==rj)throw Error("invert: does not exist");return rV(i,t)}function rJ(e,t,r){if(!e.eql(e.sqr(t),r))throw Error("Cannot find square root")}function rY(e,t){let r=(e.ORDER+rj)/rZ,n=e.pow(t,r);return rJ(e,n,t),n}function rX(e,t){let r=(e.ORDER-rF)/rW,n=e.mul(t,rz),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,rz),i),a=e.mul(s,e.sub(o,e.ONE));return rJ(e,a,t),a}function rQ(e){if(e<rq)throw Error("sqrt is not defined for small field");let t=e-rj,r=0;for(;t%rz===rN;)t/=rz,r++;let n=rz,i=r8(e);for(;1===r3(i,n);)if(n++>1e3)throw Error("Cannot find square root: probably non-prime P");if(1===r)return rY;let s=i.pow(n,t),o=(t+rj)/rz;return function(e,n){if(e.is0(n))return n;if(1!==r3(e,n))throw Error("Cannot find square root");let i=r,a=e.mul(e.ONE,s),u=e.pow(n,t),l=e.pow(n,o);for(;!e.eql(u,e.ONE);){if(e.is0(u))return e.ZERO;let t=1,r=e.sqr(u);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw Error("Cannot find square root");let n=rj<<BigInt(i-t-1),s=e.pow(a,n);i=t,a=e.sqr(s),u=e.mul(u,a),l=e.mul(l,s)}return l}}let r0=(e,t)=>(rV(e,t)&rj)===rj,r1=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function r2(e){return rC(e,r1.reduce((e,t)=>
vendor: 6,800 bytes, line 1
1(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"})),e}function r6(e,t,r=!1){let n=Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function r3(e,t){let r=(e.ORDER-rj)/rz,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!o)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function r5(e,t){void 0!==t&&(0,ro.anumber)(t);let r=void 0!==t?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function r8(e,t,r=!1,n={}){let i,s,o,a;if(e<=rN)throw Error("invalid field: expected ORDER > 0, got "+e);let u=!1;if("object"==typeof t&&null!=t){if(n.sqrt||r)throw Error("cannot specify opts in two arguments");t.BITS&&(s=t.BITS),t.sqrt&&(o=t.sqrt),"boolean"==typeof t.isLE&&(r=t.isLE),"boolean"==typeof t.modFromBytes&&(u=t.modFromBytes),a=t.allowedLengths}else"number"==typeof t&&(s=t),n.sqrt&&(o=n.sqrt);let{nBitLength:l,nByteLength:c}=r5(e,s);if(c>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let f=Object.freeze({ORDER:e,isLE:r,BITS:l,BYTES:c,MASK:rM(l),ZERO:rN,ONE:rj,allowedLengths:a,create:t=>rV(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return rN<=t&&t<e},is0:e=>e===rN,isValidNot0:e=>!f.is0(e)&&f.isValid(e),isOdd:e=>(e&rj)===rj,neg:t=>rV(-t,e),eql:(e,t)=>e===t,sqr:t=>rV(t*t,e),add:(t,r)=>rV(t+r,e),sub:(t,r)=>rV(t-r,e),mul:(t,r)=>rV(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<rN)throw Error("invalid exponent, negatives unsupported");if(r===rN)return e.ONE;if(r===rj)return t;let n=e.ONE,i=t;for(;r>rN;)r&rj&&(n=e.mul(n,i)),i=e.sqr(i),r>>=rj;return n})(f,e,t),div:(t,r)=>rV(t*rG(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>rG(t,e),sqrt:o||(t=>(i||(i=function(e){if(e%rZ===rq)return rY;if(e%rW===rF)return rX;if(e%rK===r$){let t,r,n,i,s,o;return t=r8(e),n=(r=rQ(e))(t,t.neg(t.ONE)),i=r(t,n),s=r(t,t.neg(n)),o=(e+rD)/rK,(e,t)=>{let r=e.pow(t,o),a=e.mul(r,n),u=e.mul(r,i),l=e.mul(r,s),c=e.eql(e.sqr(a),t),f=e.eql(e.sqr(u),t);r=e.cmov(r,a,c),a=e.cmov(l,u,f);let h=e.eql(e.sqr(a),t),d=e.cmov(r,a,h);return rJ(e,d,t),d}}return rQ(e)}(e)),i(f,t))),toBytes:e=>r?ry(e,c):rg(e,c),fromBytes:(t,n=!0)=>{if(a){if(!a.includes(t.length)||t.length>c)throw Error("Field.fromBytes: expected "+a+" bytes, got "+t.length);let e=new Uint8Array(c);e.set(t,r?0:e.length-t.length),t=e}if(t.length!==c)throw Error("Field.fromBytes: expected "+c+" bytes, got "+t.length);let i=r?rm(t):rp(t);if(u&&(i=rV(i,e)),!n&&!f.isValid(i))throw Error("invalid field element: outside of range 0..ORDER");return i},invertBatch:e=>r6(f,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(f)}function r4(e,t){if(!e.isOdd)throw Error("Field doesn't have isOdd");let r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}function r9(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function r7(e){let t=r9(e);return t+Math.ceil(t/2)}function ne(e,t,r=!1){let n=e.length,i=r9(t),s=r7(t);if(n<16||n<s||n>1024)throw Error("expected "+s+"-1024 bytes of input, got "+n);let o=rV(r?rm(e):rp(e),t-rj)+rj;return r?ry(o,i):rg(o,i)}e.s(["Field",()=>r8,"FpInvertBatch",()=>r6,"FpSqrtEven",()=>r4,"getMinHashLength",()=>r7,"isNegativeLE",0,r0,"mapHashToField",()=>ne,"mod",()=>rV,"nLength",()=>r5,"pow2",()=>rH,"validateField",()=>r2],70948);let nt=BigInt(0),nr=BigInt(1);function nn(e,t){let r=t.negate();return e?r:t}function ni(e,t){let r=r6(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function ns(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function no(e,t){ns(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e;return{windows:r,windowSize:n,mask:rM(e),maxNumber:i,shiftBy:BigInt(e)}}function na(e,t,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,a=Number(e&i),u=e>>o;a>n&&(a-=s,u+=nr);let l=t*n,c=l+Math.abs(a)-1,f=0===a;return{nextN:u,offset:c,isZero:f,isNeg:a<0,isNegF:t%2!=0,offsetF:l}}let nu=new WeakMap,nl=new WeakMap;function nc(e){return nl.get(e)||1}function nf(e){if(e!==nt)throw Error("invalid wNAF")}class nh{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>nt;)t&nr&&(r=r.add(n)),n=n.double(),t>>=nr;return r}precomputeWindow(e,t){let{windows:r,windowSize:n}=no(t,this.bits),i=[],s=e,o=s;for(let e=0;e<r;e++){o=s,i.push(o);for(let e=1;e<n;e++)o=o.add(s),i.push(o);s=o.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let n=this.ZERO,i=this.BASE,s=no(e,this.bits);for(let e=0;e<s.windows;e++){let{nextN:o,offset:a,isZero:u,isNeg:l,isNegF:c,offsetF:f}=na(r,e,s);r=o,u?i=i.add(nn(c,t[f])):n=n.add(nn(l,t[a]))}return nf(r),{p:n,f:i}}wNAFUnsafe(e,t,r,n=this.ZERO){let i=no(e,this.bits);for(let e=0;e<i.windows&&r!==nt;e++){let{nextN:s,offset:o,isZero:a,isNeg:u}=na(r,e,i);if(r=s,!a){let e=t[o];n=n.add(u?e.negate():e)}}return nf(r),n}getPrecomputes(e,t,r){let n=nu.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),nu.set(t,n))),n}cached(e,t,r){let n=nc(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){let i=nc(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){ns(t,this.bits),nl.set(e,t),nu.delete(e)}hasCache(e){return 1!==nc(e)}}function nd(e,t,r,n){let i=t,s=e.ZERO,o=e.ZERO;for(;r>nt||n>nt;)r&nr&&(s=s.add(i)),n&nr&&(o=o.add(i)),i=i.double(),r>>=nr,n>>=nr;return{p1:s,p2:o}}function np(e,t,r,n){if(!Array.isArray(r))throw Error("array expected");r.forEach((t,r)=>{if(!(t instanceof e))throw Error("invalid point at index "+r)});if(!Array.isArray(n))throw Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)});let i=r.length,s=n.length;if(i!==s)throw Error("arrays of points and scalars must have equal length");let o=e.ZERO,a=rA(BigInt(i)),u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);let l=rM(u),c=Array(Number(l)+1).fill(o),f=Math.floor((t.BITS-1)/u)*u,h=o;for(let e=f;e>=0;e-=u){c.fill(o);for(let t=0;t<s;t++){let i=Number(n[t]>>BigInt(e)&l);c[i]=c[i].add(r[t])}let t=o;for(let e=c.length-1,r=o;e>0;e--)r=r.add(c[e]),t=t.add(r);if(h=h.add(t),0!==e)for(let e=0;e<u;e++)h=h.double()}return h}function nm(e,t,r){if(!t)return r8(e,{isLE:r});if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return r2(t),t}function ng(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw Error(`expected valid ${e} CURVE object`);for(let e of["p","n","h"]){let r=t[e];if(!("bigint"==typeof r&&r>nt))throw Error(`CURVE.${e} must be positive bigint`)}
1let i=nm(t.p,r.Fp,n),s=nm(t.n,r.Fn,n);for(let r of["Gx","Gy","a","weierstrass"===e?"b":"d"])if(!i.isValid(t[r]))throw Error(`CURVE.${r} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:s}}e.s(["_createCurveFields",()=>ng,"mulEndoUnsafe",()=>nd,"negateCt",()=>nn,"normalizeZ",()=>ni,"pippenger",()=>np,"wNAF",()=>nh],10588);let ny=BigInt(0),nb=BigInt(1),nv=BigInt(2),nw=BigInt(8);class n_{constructor(e){this.ep=e}static fromBytes(e){rU()}static fromHex(e){rU()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,ro.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}}function nx(e,t){if(nk(e),nk(t),e<0||e>=1<<8*t)throw Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=255&e,e>>>=8;return new Uint8Array(r)}function nk(e){if(!Number.isSafeInteger(e))throw Error("number expected")}function nS(e){if(!(0,ro.isBytes)(e)&&"string"!=typeof e)throw Error("DST must be Uint8Array or string");return"string"==typeof e?(0,ro.utf8ToBytes)(e):e}function nE(e,t,r,n){(0,ro.abytes)(e),nk(r),(t=nS(t)).length>255&&(t=n((0,ro.concatBytes)((0,ro.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));let{outputLen:i,blockLen:s}=n,o=Math.ceil(r/i);if(r>65535||o>255)throw Error("expand_message_xmd: invalid lenInBytes");let a=(0,ro.concatBytes)(t,nx(t.length,1)),u=nx(0,s),l=nx(r,2),c=Array(o),f=n((0,ro.concatBytes)(u,e,l,nx(0,1),a));c[0]=n((0,ro.concatBytes)(f,nx(1,1),a));for(let e=1;e<=o;e++){let t=[function(e,t){let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}(f,c[e-1]),nx(e+1,1),a];c[e]=n((0,ro.concatBytes)(...t))}return(0,ro.concatBytes)(...c).slice(0,r)}function nA(e,t,r){let n;rC(r,{p:"bigint",m:"number",k:"number",hash:"function"});let{p:i,k:s,m:o,hash:a,expand:u,DST:l}=r;if(!rP(r.hash))throw Error("expected valid hash");(0,ro.abytes)(e),nk(t);let c=Math.ceil((i.toString(2).length+s)/8),f=t*o*c;if("xmd"===u)n=nE(e,l,f,a);else if("xof"===u)n=function(e,t,r,n,i){if((0,ro.abytes)(e),nk(r),(t=nS(t)).length>255){let e=Math.ceil(2*n/8);t=i.create({dkLen:e}).update((0,ro.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(nx(r,2)).update(t).update(nx(t.length,1)).digest()}(e,l,f,s,a);else if("_internal_pass"===u)n=e;else throw Error('expand must be "xmd" or "xof"');let h=Array(t);for(let e=0;e<t;e++){let t=Array(o);for(let r=0;r<o;r++){let s=c*(r+e*o),a=n.subarray(s,s+c);t[r]=rV(rp(a),i)}h[e]=t}return h}function nB(e,t){let r=t.map(e=>Array.from(e).reverse());return(t,n)=>{let[i,s,o,a]=r.map(r=>r.reduce((r,n)=>e.add(e.mul(r,t),n))),[u,l]=r6(e,[s,a],!0);return t=e.mul(i,u),n=e.mul(n,e.mul(o,l)),{x:t,y:n}}}let nI=(0,ro.utf8ToBytes)("HashToScalar-");function nM(e,t,r){if("function"!=typeof t)throw Error("mapToCurve() must be defined");function n(r){return e.fromAffine(t(r))}function i(t){let r=t.clearCofactor();return r.equals(e.ZERO)?e.ZERO:(r.assertValidity(),r)}return{defaults:r,hashToCurve(e,t){let s=nA(e,2,Object.assign({},r,t)),o=n(s[0]),a=n(s[1]);return i(o.add(a))},encodeToCurve(e,t){let s=r.encodeDST?{DST:r.encodeDST}:{};return i(n(nA(e,1,Object.assign({},r,s,t))[0]))},mapToCurve(e){if(!Array.isArray(e))throw Error("expected array of bigints");for(let t of e)if("bigint"!=typeof t)throw Error("expected array of bigints");return i(n(e))},hashToScalar:(t,n)=>nA(t,1,Object.assign({},r,{p:e.Fn.ORDER,m:1,DST:nI},n))[0][0]}}e.s(["_DST_scalar",0,nI,"createHasher",()=>nM,"expand_message_xmd",()=>nE,"isogenyMap",()=>nB],33795),BigInt(0),BigInt(1),BigInt(2);let nT=BigInt(0),nO=BigInt(1),nR=BigInt(2),nP=BigInt(3),nC=BigInt(5),nU=BigInt(8),nL=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),nN={p:nL,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:nU,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")},nj=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function nz(e,t){var r;let n,i,s,o,a,u,l,c,f,h,d,p,m,g,y=rV(t*t*t,nL),b=(r=e*rV(y*y*t,nL),n=BigInt(10),i=BigInt(20),s=BigInt(40),o=BigInt(80),u=rH(a=r*r%nL*r%nL,nR,nL)*a%nL,l=rH(u,nO,nL)*r%nL,c=rH(l,nC,nL)*l%nL,f=rH(c,n,nL)*c%nL,h=rH(f,i,nL)*f%nL,d=rH(h,s,nL)*h%nL,p=rH(d,o,nL)*d%nL,m=rH(p,o,nL)*d%nL,g=rH(m,n,nL)*c%nL,{pow_p_5_8:rH(g,nR,nL)*r%nL,b2:a}).pow_p_5_8,v=rV(e*y*b,nL),w=rV(t*v*v,nL),_=v,x=rV(v*nj,nL),k=w===e,S=w===rV(-e,nL),E=w===rV(-e*nj,nL);return k&&(v=_),(S||E)&&(v=x),r0(v,nL)&&(v=rV(-v,nL)),{isValid:k||S,value:v}}let nq=r8(nN.p,{isLE:!0}),nZ=r8(nN.n,{isLE:!0}),nF=function(e){let t,r,n,i,{CURVE:s,curveOpts:o,hash:a,eddsaOpts:u}=(t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:r8(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},n={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve},{CURVE:t,curveOpts:r,hash:e.hash,eddsaOpts:n}),l=function(e,t,r={}){if("function"!=typeof t)throw Error('"hash" function param is required');rC(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:s,Fn:o}=e,a=r.randomBytes||ro.randomBytes,u=r.adjustScalarBytes||(e=>e),l=r.domain||((e,t,r)=>{if(rc(r,"phflag"),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function c(e){return o.create(rm(e))}function f(e){var r;let n,s,o,a,l,{head:f,prefix:h,scalar:d}=(r=rv("private key",r=e,n=g.secretKey),o=u((s=rv("hashed private key",t(r),2*n)).slice(0,n)),a=s.slice(n,2*n),l=c(o),{head:o,prefix:a,scalar:l}),p=i.multiply(d),m=p.toBytes();return{head:f,prefix:h,scalar:d,point:p,pointBytes:m}}function h(e){return f(e).pointBytes}function d(e=Uint8Array.of(),...r){return c(t(l((0,ro.concatBytes)(...r),rv("context",e),!!n)))}let p={zip215:!0},m=s.BYTES,g={secretKey:m,publicKey:m,signature:2*m,seed:m};function y(e=a(g.seed)){return rf(e,g.seed,"seed")}let b={getExtendedPublicKey:f,randomSecretKey:y,isValidSecretKey:function(e){return(0,ro.isBytes)(e)&&e.length===o.BYTES},isValidPublicKey:function(t,r){try{return!!e.fromBytes(t,r)}catch(e){return!1}},toMontgomery(t){let{y:r}=e.fromBytes(t),n=g.publicKey,i=32===n;if(!i&&57!==n)throw Error("only defined for 25519 and 448");let o=i?s.div(nb+r,nb-r):s.div(r-nb,r+nb);return s.toBytes(o)},toMontgomerySecret(e){let r=g.secretKey;return rf(e,r),u(t(e.subarray(0,r))).subarray(0,r)},randomPrivateKey:y,precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({keygen:function(e){let t=b.randomSecretKey(e);return{secretKey:t,publicKey:h(t)}},getPublicKey:h,sign:function(e,t,r={}){e=rv("message",e),n&&(e=n(e));let{prefix:s,scalar:a,pointBytes:u}=f(t),l=d(r.context,s,e),c=i.multiply(l).toBytes(),h=d(r.context,c,u,e),p=o.create(l+h*a);
1if(!o.isValid(p))throw Error("sign failed: invalid s");return rf((0,ro.concatBytes)(c,o.toBytes(p)),g.signature,"result")},verify:function(t,r,s,o=p){let a,u,l,{context:c,zip215:f}=o,h=g.signature;t=rv("signature",t,h),r=rv("message",r),s=rv("publicKey",s,g.publicKey),void 0!==f&&rc(f,"zip215"),n&&(r=n(r));let m=h/2,y=t.subarray(0,m),b=rm(t.subarray(m,h));try{a=e.fromBytes(s,f),u=e.fromBytes(y,f),l=i.multiplyUnsafe(b)}catch(e){return!1}if(!f&&a.isSmallOrder())return!1;let v=d(c,u.toBytes(),a.toBytes(),r);return u.add(a.multiplyUnsafe(v)).subtract(l).clearCofactor().is0()},utils:b,Point:e,lengths:g})}(function(e,t={}){var r,n;let i,s,o,a,u,l=ng("edwards",e,t,t.FpFnLE),{Fp:c,Fn:f}=l,h=l.CURVE,{h:d}=h;rC(t,{},{uvRatio:"function"});let p=nv<<BigInt(8*f.BYTES)-nb,m=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:c.sqrt(c.div(e,t))}}catch(e){return{isValid:!1,value:ny}}});if(r=h.Gx,n=h.Gy,i=c.sqr(r),s=c.sqr(n),o=c.add(c.mul(h.a,i),s),a=c.add(c.ONE,c.mul(h.d,c.mul(i,s))),!c.eql(o,a))throw Error("bad curve params: generator point");function g(e,t,r=!1){return rE("coordinate "+e,t,r?nb:ny,p),t}function y(e){if(!(e instanceof w))throw Error("ExtendedPoint expected")}let b=rL((e,t)=>{let r,n,{X:i,Y:s,Z:o}=e,a=e.is0();null==t&&(t=a?nw:c.inv(o));let u=(r=i*t,c.create(r)),l=(n=s*t,c.create(n)),f=c.mul(o,t);if(a)return{x:ny,y:nb};if(f!==nb)throw Error("invZ was invalid");return{x:u,y:l}}),v=rL(e=>{let t,r,n,i,s,o,a,u,l,f,d,p,{a:m,d:g}=h;if(e.is0())throw Error("bad point: ZERO");let{X:y,Y:b,Z:v,T:w}=e,_=(t=y*y,c.create(t)),x=(r=b*b,c.create(r)),k=(n=v*v,c.create(n)),S=(i=k*k,c.create(i));if(a=k*(s=_*m,o=c.create(s)+x,c.create(o)),c.create(a)!==(f=S+(l=g*(u=_*x,c.create(u)),c.create(l)),c.create(f)))throw Error("bad point: equation left != right (1)");if(d=y*b,c.create(d)!==(p=v*w,c.create(p)))throw Error("bad point: equation left != right (2)");return!0});class w{constructor(e,t,r,n){this.X=g("x",e),this.Y=g("y",t),this.Z=g("z",r,!0),this.T=g("t",n),Object.freeze(this)}static CURVE(){return h}static fromAffine(e){let t;if(e instanceof w)throw Error("extended point not allowed");let{x:r,y:n}=e||{};return g("x",r),g("y",n),new w(r,n,nb,(t=r*n,c.create(t)))}static fromBytes(e,t=!1){let r,n,i,s,o=c.BYTES,{a,d:u}=h;e=r_(rf(e,o,"point")),rc(t,"zip215");let l=r_(e),f=e[o-1];l[o-1]=-129&f;let d=rm(l);rE("point.y",d,ny,t?p:c.ORDER);let g=(r=d*d,c.create(r)),{isValid:y,value:b}=m((n=g-nb,c.create(n)),(i=u*g-a,c.create(i)));if(!y)throw Error("bad point: invalid y coordinate");let v=(b&nb)===nb,_=(128&f)!=0;if(!t&&b===ny&&_)throw Error("bad point: x=0 and x_0=1");return _!==v&&(s=-b,b=c.create(s)),w.fromAffine({x:b,y:d})}static fromHex(e,t=!1){return w.fromBytes(rv("point",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return _.createCache(this,e),t||this.multiply(nv),this}assertValidity(){v(this)}equals(e){let t,r,n,i;y(e);let{X:s,Y:o,Z:a}=this,{X:u,Y:l,Z:f}=e,h=(t=s*f,c.create(t)),d=(r=u*a,c.create(r)),p=(n=o*f,c.create(n)),m=(i=l*a,c.create(i));return h===d&&p===m}is0(){return this.equals(w.ZERO)}negate(){let e,t;return new w((e=-this.X,c.create(e)),this.Y,this.Z,(t=-this.T,c.create(t)))}double(){let e,t,r,n,i,s,o,a,u,l,f,{a:d}=h,{X:p,Y:m,Z:g}=this,y=(e=p*p,c.create(e)),b=(t=m*m,c.create(t)),v=(n=nv*(r=g*g,c.create(r)),c.create(n)),_=(i=d*y,c.create(i)),x=p+m,k=(s=x*x,o=c.create(s)-y-b,c.create(o)),S=_+b,E=S-v,A=_-b,B=(a=k*E,c.create(a)),I=(u=S*A,c.create(u)),M=(l=k*A,c.create(l));return new w(B,I,(f=E*S,c.create(f)),M)}add(e){let t,r,n,i,s,o,a,u,l,f;y(e);let{a:d,d:p}=h,{X:m,Y:g,Z:b,T:v}=this,{X:_,Y:x,Z:k,T:S}=e,E=(t=m*_,c.create(t)),A=(r=g*x,c.create(r)),B=(n=v*p*S,c.create(n)),I=(i=b*k,c.create(i)),M=(s=(m+g)*(_+x)-E-A,c.create(s)),T=I-B,O=I+B,R=(o=A-d*E,c.create(o)),P=(a=M*T,c.create(a)),C=(u=O*R,c.create(u)),U=(l=M*R,c.create(l));return new w(P,C,(f=T*O,c.create(f)),U)}subtract(e){return this.add(e.negate())}multiply(e){if(!f.isValidNot0(e))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:t,f:r}=_.cached(this,e,e=>ni(w,e));return ni(w,[t,r])[0]}multiplyUnsafe(e,t=w.ZERO){if(!f.isValid(e))throw Error("invalid scalar: expected 0 <= sc < curve.n");return e===ny?w.ZERO:this.is0()||e===nb?this:_.unsafe(this,e,e=>ni(w,e),t)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return _.unsafe(this,h.n).is0()}toAffine(e){return b(this,e)}clearCofactor(){return d===nb?this:this.multiplyUnsafe(d)}toBytes(){let{x:e,y:t}=this.toAffine(),r=c.toBytes(t);return r[r.length-1]|=e&nb?128:0,r}toHex(){return(0,ro.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return ni(w,e)}static msm(e,t){return np(w,f,e,t)}
1_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}w.BASE=new w(h.Gx,h.Gy,nb,(u=h.Gx*h.Gy,c.create(u))),w.ZERO=new w(ny,nb,nb,ny),w.Fp=c,w.Fn=f;let _=new nh(w,f.BITS);return w.BASE.precompute(8),w}(s,o),a,u);return i=l.Point,Object.assign({},l,{ExtendedPoint:i,CURVE:e,nBitLength:i.Fn.BITS,nByteLength:i.Fn.BYTES})}({...nN,Fp:nq,hash:rs.sha512,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:nz}),nD=(nL+nP)/nU,nW=nq.pow(nR,nD),n$=nq.sqrt(nq.neg(nq.ONE)),nK=r4(nq,nq.neg(BigInt(486664)));nM(nF.Point,e=>(function(e){let t,r,n,i,s,o,a,u,l,c,f,h,d,p,m,g,y,b,v,w,_,x,k,{xMn:S,xMd:E,yMn:A,yMd:B}=(t=(nL-nC)/nU,r=BigInt(486662),n=nq.sqr(e),n=nq.mul(n,nR),i=nq.add(n,nq.ONE),s=nq.neg(r),o=nq.sqr(i),a=nq.mul(o,i),u=nq.mul(n,r),u=nq.mul(u,s),u=nq.add(u,o),u=nq.mul(u,s),l=nq.sqr(a),o=nq.sqr(l),l=nq.mul(l,a),l=nq.mul(l,u),o=nq.mul(o,l),c=nq.pow(o,t),c=nq.mul(c,l),f=nq.mul(c,n$),o=nq.sqr(c),o=nq.mul(o,a),h=nq.eql(o,u),d=nq.cmov(f,c,h),p=nq.mul(s,n),m=nq.mul(c,e),m=nq.mul(m,nW),g=nq.mul(m,n$),y=nq.mul(u,n),o=nq.sqr(m),o=nq.mul(o,a),b=nq.eql(o,y),v=nq.cmov(g,m,b),o=nq.sqr(d),o=nq.mul(o,a),w=nq.eql(o,u),_=nq.cmov(p,s,w),x=nq.cmov(v,d,w),k=nq.isOdd(x),{xMn:_,xMd:i,yMn:x=nq.cmov(x,nq.neg(x),w!==k),yMd:nO}),I=nq.mul(S,B);I=nq.mul(I,nK);let M=nq.mul(E,A),T=nq.sub(S,E),O=nq.add(S,E),R=nq.mul(M,O),P=nq.eql(R,nq.ZERO);I=nq.cmov(I,nq.ZERO,P),M=nq.cmov(M,nq.ONE,P),T=nq.cmov(T,nq.ONE,P),O=nq.cmov(O,nq.ONE,P);let[C,U]=r6(nq,[M,O],!0);return{x:nq.mul(I,C),y:nq.mul(T,U)}})(e[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:nL,m:1,k:128,expand:"xmd",hash:rs.sha512});let nV=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),nH=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),nG=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),nJ=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),nY=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),nX=e=>nF.Point.Fp.create(rm(e)&nY);function nQ(e){let t,r,n,i,s,o,a,u,l,c,f,h,d,p,m,{d:g}=nN,y=(t=nj*e*e,nq.create(t)),b=(r=(y+nO)*nG,nq.create(r)),v=BigInt(-1),w=(i=(v-g*y)*(n=y+g,nq.create(n)),nq.create(i)),{isValid:_,value:x}=nz(b,w),k=(s=x*e,nq.create(s));r0(k,nL)||(o=-k,k=nq.create(o)),_||(x=k),_||(v=y);let S=(a=v*(y-nO)*nJ-w,nq.create(a)),E=x*x,A=(u=(x+x)*w,nq.create(u)),B=(l=S*nV,nq.create(l)),I=(c=nO-E,nq.create(c)),M=(f=nO+E,nq.create(f));return new nF.Point((h=A*M,nq.create(h)),(d=I*B,nq.create(d)),(p=B*M,nq.create(p)),(m=A*I,nq.create(m)))}class n0 extends n_{constructor(e){super(e)}static fromAffine(e){return new n0(nF.Point.fromAffine(e))}assertSame(e){if(!(e instanceof n0))throw Error("RistrettoPoint expected")}init(e){return new n0(e)}static hashToCurve(e){var t;let r,n;return t=rv("ristrettoHash",e,64),(0,ro.abytes)(t,64),r=nQ(nX(t.subarray(0,32))),n=nQ(nX(t.subarray(32,64))),new n0(r.add(n))}static fromBytes(e){let t,r,n,i,s,o,a,u,l,c,f,h,d;(0,ro.abytes)(e,32);let{a:p,d:m}=nN,g=nX(e);if(!rw(nq.toBytes(g),e)||r0(g,nL))throw Error("invalid ristretto255 encoding 1");let y=(t=g*g,nq.create(t)),b=(r=nO+p*y,nq.create(r)),v=(n=nO-p*y,nq.create(n)),w=(i=b*b,nq.create(i)),_=(s=v*v,nq.create(s)),x=(o=p*m*w-_,nq.create(o)),{isValid:k,value:S}=(a=x*_,nz(nO,nq.create(a))),E=(u=S*v,nq.create(u)),A=(l=S*E*x,nq.create(l)),B=(c=(g+g)*E,nq.create(c));r0(B,nL)&&(f=-B,B=nq.create(f));let I=(h=b*A,nq.create(h)),M=(d=B*I,nq.create(d));if(!k||r0(M,nL)||I===nT)throw Error("invalid ristretto255 encoding 2");return new n0(new nF.Point(B,I,nO,M))}static fromHex(e){return n0.fromBytes(rv("ristrettoHex",e,32))}static msm(e,t){return np(n0,nF.Point.Fn,e,t)}toBytes(){let e,t,r,n,i,s,o,a,u,l,c,f,h,{X:d,Y:p,Z:m,T:g}=this.ep,y=(e=m+p,r=nq.create(e)*(t=m-p,nq.create(t)),nq.create(r)),b=(n=d*p,nq.create(n)),{value:v}=(s=y*(i=b*b,nq.create(i)),nz(nO,nq.create(s))),w=(o=v*y,nq.create(o)),_=(a=v*b,nq.create(a)),x=(u=w*_*g,nq.create(u));if(r0(g*x,nL)){let e,t,r=(e=p*nj,nq.create(e)),n=(t=d*nj,nq.create(t));d=r,p=n,h=nq.create(w*nH)}else h=_;r0(d*x,nL)&&(l=-p,p=nq.create(l));let k=(c=(m-p)*h,nq.create(c));return r0(k,nL)&&(f=-k,k=nq.create(f)),nq.toBytes(k)}equals(e){let t,r,n,i;
1this.assertSame(e);let{X:s,Y:o}=this.ep,{X:a,Y:u}=e.ep,l=(t=s*u,nq.create(t)===(r=o*a,nq.create(r))),c=(n=o*u,nq.create(n)===(i=s*a,nq.create(i)));return l||c}is0(){return this.equals(n0.ZERO)}}n0.BASE=new n0(nF.Point.BASE),n0.ZERO=new n0(nF.Point.ZERO),n0.Fp=nq,n0.Fn=nZ,e.s(["ed25519",0,nF],14303)},16853,(e,t,r)=>{!function(e,t){"use strict";function r(e,t){if(!e)throw 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"))}e.exports=i,i.BN=i,i.wordSize=26;try{c="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:void 0}catch(e){}function s(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function o(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function a(e,t,n,i){for(var s=0,o=0,a=Math.min(e.length,n),u=t;u<a;u++){var l=e.charCodeAt(u)-48;s*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,r(l>=0&&o<i,"Invalid character"),s+=o}return s}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(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 0>e.cmp(t)?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<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<0x4000000?(this.words=[0x3ffffff&e],this.length=1):e<0x10000000000000?(this.words=[0x3ffffff&e,e/0x4000000&0x3ffffff],this.length=2):(r(e<0x20000000000000),this.words=[0x3ffffff&e,e/0x4000000&0x3ffffff,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=s<<a&0x3ffffff,this.words[i+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=s<<a&0x3ffffff,this.words[i+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,i++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var n,i=0;i<this.length;i++)this.words[i]=0;var s=0,a=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=o(e,t,i)<<s,this.words[a]|=0x3ffffff&n,s>=18?(s-=18,a+=1,this.words[a]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=o(e,t,i)<<s,this.words[a]|=0x3ffffff&n,s>=18?(s-=18,a+=1,this.words[a]|=n>>>26):s+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=0x3ffffff;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,u=Math.min(s,s-o)+r,l=0,c=r;c<u;c+=n)l=a(e,c,c+n,t),this.imuln(i),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==o){var f=1;for(l=a(e,c,e.length,t),c=0;c<o;c++)f*=t;this.imuln(f),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){u(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&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")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c,f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,0x2000000,0x290d741,0x1000000,
vendor: 35,420 bytes, line 1
10x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];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],s=0|t.words[0],o=i*s,a=0x3ffffff&o,u=o/0x4000000|0;r.words[0]=a;for(var l=1;l<n;l++){for(var c=u>>>26,f=0x3ffffff&u,h=Math.min(l,t.length-1),d=Math.max(0,l-e.length+1);d<=h;d++){var p=l-d|0;c+=(o=(i=0|e.words[p])*(s=0|t.words[d])+f)/0x4000000|0,f=0x3ffffff&o}r.words[l]=0|f,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}i.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){for(var n="",i=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=((a<<i|s)&0xffffff).toString(16);s=a>>>24-i&0xffffff,(i+=2)>=26&&(i-=26,o--),n=0!==s||o!==this.length-1?f[6-u.length]+u+n:u+n}for(0!==s&&(n=s.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=h[e],c=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);n=(p=p.idivn(c)).isZero()?m+n:f[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+=0x4000000*this.words[1]:3===this.length&&1===this.words[2]?e+=0x10000000000000+0x4000000*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)},c&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=e.allocUnsafe?e.allocUnsafe(s):new e(s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=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(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r((this.negative|e.negative)==0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.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;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r((this.negative|e.negative)==0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.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){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r((this.negative|e.negative)==0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.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;i<t;i++)this.words[i]=0x3ffffff&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&0x3ffffff>>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),t?this.words[n]=this.words[n]|1<<i:this.words[n]=this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var t,r,n,i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=0x3ffffff&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=0x3ffffff&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,n=this.iadd(e);return e.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(t=this,r=e):(t=e,r=this);for(var s=0,o=0;o<r.length;o++)s=(n=(0|t.words[o])-(0|r.words[o])+s)>>26,this.words[o]=0x3ffffff&n;for(;0!==s&&o<t.length;o++)s=(n=(0|t.words[o])+s)>>26,this.words[o]=0x3ffffff&n;if(0===s&&o<t.length&&t!==this)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=Math.max(this.length,o),t!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,s,o=e.words,a=t.words,u=r.words,l=0,c=0|o[0],f=8191&c,h=c>>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,x=0|o[4],k=8191&x,S=x>>>13,E=0|o[5],A=8191&E,B=E>>>13,I=0|o[6],M=8191&I,T=I>>>13,O=0|o[7],R=8191&O,P=O>>>13,C=0|o[8],U=8191&C,L=C>>>13,N=0|o[9],j=8191&N,z=N>>>13,q=0|a[0],Z=8191&q,F=q>>>13,D=0|a[1],W=8191&D,$=D>>>13,K=0|a[2],V=8191&K,H=K>>>13,G=0|a[3],J=8191&G,Y=G>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,et=0|a[5],er=8191&et,en=et>>>13,ei=0|a[6],es=8191&ei,eo=ei>>>13,ea=0|a[7],eu=8191&ea,el=ea>>>13,ec=0|a[8],ef=8191&ec,eh=ec>>>13,ed=0|a[9],ep=8191&ed,em=ed>>>13;r.negative=e.negative^t.negative,r.length=19,n=Math.imul(f,Z);var eg=(l+n|0)+((8191&(i=(i=Math.imul(f,F))+Math.imul(h,Z)|0))<<13)|0;l=((s=Math.imul(h,F))+(i>>>13)|0)+(eg>>>26)|0,eg&=0x3ffffff,n=Math.imul(p,Z),i=(i=Math.imul(p,F))+Math.imul(m,Z)|0,s=Math.imul(m,F),n=n+Math.imul(f,W)|0;var ey=(l+n|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(h,W)|0))<<13)|0;l=((s=s+Math.imul(h,$)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=0x3ffffff,n=Math.imul(y,Z),i=(i=Math.imul(y,F))+Math.imul(b,Z)|0,s=Math.imul(b,F),n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,$)|0,n=n+Math.imul(f,V)|0;var eb=(l+n|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(h,V)|0))<<13)|0;l=((s=s+Math.imul(h,H)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=0x3ffffff,n=Math.imul(w,Z),i=(i=Math.imul(w,F))+Math.imul(_,Z)|0,s=Math.imul(_,F),n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,$)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,H)|0,n=n+Math.imul(f,J)|0;var ev=(l+n|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,J)|0))<<13)|0;l=((s=s+Math.imul(h,Y)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=0x3ffffff,n=Math.imul(k,Z),i=(i=Math.imul(k,F))+Math.imul(S,Z)|0,s=Math.imul(S,F),n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,$)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,H)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,J)|0,s=s+Math.imul(m,Y)|0,n=n+Math.imul(f,Q)|0;var ew=(l+n|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(h,Q)|0))<<13)|0;l=((s=s+Math.imul(h,ee)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=0x3ffffff,n=Math.imul(A,Z),i=(i=Math.imul(A,F))+Math.imul(B,Z)|0,s=Math.imul(B,F),n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,$)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,H)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,s=s+Math.imul(m,ee)|0,n=n+Math.imul(f,er)|0;var e_=(l+n|0)+((8191&(i=(i=i+Math.imul(f,en)|0)+Math.imul(h,er)|0))<<13)|0;l=((s=s+Math.imul(h,en)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=0x3ffffff,n=Math.imul(M,Z),i=(i=Math.imul(M,F))+Math.imul(T,Z)|0,s=Math.imul(T,F),n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(B,W)|0,s=s+Math.imul(B,$)|0,n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(S,V)|0,s=s+Math.imul(S,H)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,Y)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(p,er)|0,i=(i=i+Math.imul(p,en)|0)+Math.imul(m,er)|0,s=s+Math.imul(m,en)|0,n=n+Math.imul(f,es)|0;var ex=(l+n|0)+((8191&(i=(i=i+Math.imul(f,eo)|0)+Math.imul(h,es)|0))<<13)|0;l=((s=s+Math.imul(h,eo)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=0x3ffffff,n=Math.imul(R,Z),i=(i=Math.imul(R,F))+Math.imul(P,Z)|0,s=Math.imul(P,F),n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,$)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,$)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(B,V)|0,s=s+Math.imul(B,H)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(S,J)|0,s=s+Math.imul(S,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,s=s+Math.imul(_,ee)|0,n=n+Math.imul(y,er)|0,i=(i=i+Math.imul(y,en)|0)+Math.imul(b,er)|0,s=s+Math.imul(b,en)|0,n=n+Math.imul(p,es)|0,i=(i=i+Math.imul(p,eo)|0)+Math.imul(m,es)|0,s=s+Math.imul(m,eo)|0,n=n+Math.imul(f,eu)|0;var ek=(l+n|0)+((8191&(i=(i=i+Math.imul(f,el)|0)+Math.imul(h,eu)|0))<<13)|0;l=((s=s+Math.imul(h,el)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=0x3ffffff,n=Math.imul(U,Z),i=(i=Math.imul(U,F))+Math.imul(L,Z)|0,s=Math.imul(L,F),n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(P,W)|0,s=s+Math.imul(P,$)|0,n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,H)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(B,J)|0,s=s+Math.imul(B,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(S,Q)|0,s=s+Math.imul(S,ee)|0,n=n+Math.imul(w,er)|0,i=(i=i+Math.imul(w,en)|0)+Math.imul(_,er)|0,s=s+Math.imul(_,en)|0,n=n+Math.imul(y,es)|0,i=(i=i+Math.imul(y,eo)|0)+Math.imul(b,es)|0,s=s+Math.imul(b,eo)|0,n=n+Math.imul(p,eu)|0,i=(i=i+Math.imul(p,el)|0)+Math.imul(m,eu)|0,s=s+Math.imul(m,el)|0,n=n+Math.imul(f,ef)|0;var eS=(l+n|0)+((8191&(i=(i=i+Math.imul(f,eh)|0)+Math.imul(h,ef)|0))<<13)|0;l=((s=s+Math.imul(h,eh)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=0x3ffffff,n=Math.imul(j,Z),i=(i=Math.imul(j,F))+Math.imul(z,Z)|0,s=Math.imul(z,F),n=n+Math.imul(U,W)|0,i=(i=i+Math.imul(U,$)|0)+Math.imul(L,W)|0,s=s+Math.imul(L,$)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,H)|0,n=n+Math.imul(M,J)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(B,Q)|0,s=s+Math.imul(B,ee)|0,n=n+Math.imul(k,er)|0,i=(i=i+Math.imul(k,en)|0)+Math.imul(S,er)|0,s=s+Math.imul(S,en)|0,n=n+Math.imul(w,es)|0,i=(i=i+Math.imul(w,eo)|0)+Math.imul(_,es)|0,s=s+Math.imul(_,eo)|0,n=n+Math.imul(y,eu)|0,i=(i=i+Math.imul(y,el)|0)+Math.imul(b,eu)|0,s=s+Math.imul(b,el)|0,n=n+Math.imul(p,ef)|0,i=(i=i+Math.imul(p,eh)|0)+Math.imul(m,ef)|0,s=s+Math.imul(m,eh)|0,n=n+Math.imul(f,ep)|0;var eE=(l+n|0)+((8191&(i=(i=i+Math.imul(f,em)|0)+Math.imul(h,ep)|0))<<13)|0;l=((s=s+Math.imul(h,em)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=0x3ffffff,n=Math.imul(j,W),i=(i=Math.imul(j,$))+Math.imul(z,W)|0,s=Math.imul(z,$),n=n+Math.imul(U,V)|0,i=(i=i+Math.imul(U,H)|0)+Math.imul(L,V)|0,s=s+Math.imul(L,H)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,Y)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,ee)|0,n=n+Math.imul(A,er)|0,i=(i=i+Math.imul(A,en)|0)+Math.imul(B,er)|0,s=s+Math.imul(B,en)|0,n=n+Math.imul(k,es)|0,i=(i=i+Math.imul(k,eo)|0)+Math.imul(S,es)|0,s=s+Math.imul(S,eo)|0,n=n+Math.imul(w,eu)|0,i=(i=i+Math.imul(w,el)|0)+Math.imul(_,eu)|0,s=s+Math.imul(_,el)|0,n=n+Math.imul(y,ef)|0,i=(i=i+Math.imul(y,eh)|0)+Math.imul(b,ef)|0,s=s+Math.imul(b,eh)|0,n=n+Math.imul(p,ep)|0;var eA=(l+n|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;l=((s=s+Math.imul(m,em)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=0x3ffffff,n=Math.imul(j,V),i=(i=Math.imul(j,H))+Math.imul(z,V)|0,s=Math.imul(z,H),n=n+Math.imul(U,J)|0,i=(i=i+Math.imul(U,Y)|0)+Math.imul(L,J)|0,s=s+Math.imul(L,Y)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,ee)|0,n=n+Math.imul(M,er)|0,i=(i=i+Math.imul(M,en)|0)+Math.imul(T,er)|0,s=s+Math.imul(T,en)|0,n=n+Math.imul(A,es)|0,i=(i=i+Math.imul(A,eo)|0)+Math.imul(B,es)|0,s=s+Math.imul(B,eo)|0,n=n+Math.imul(k,eu)|0,i=(i=i+Math.imul(k,el)|0)+Math.imul(S,eu)|0,s=s+Math.imul(S,el)|0,n=n+Math.imul(w,ef)|0,i=(i=i+Math.imul(w,eh)|0)+Math.imul(_,ef)|0,s=s+Math.imul(_,eh)|0,n=n+Math.imul(y,ep)|0;var eB=(l+n|0)+((8191&(i=(i=i+Math.imul(y,em)|0)+Math.imul(b,ep)|0))<<13)|0;l=((s=s+Math.imul(b,em)|0)+(i>>>13)|0)+(eB>>>26)|0,eB&=0x3ffffff,n=Math.imul(j,J),i=(i=Math.imul(j,Y))+Math.imul(z,J)|0,s=Math.imul(z,Y),n=n+Math.imul(U,Q)|0,i=(i=i+Math.imul(U,ee)|0)+Math.imul(L,Q)|0,s=s+Math.imul(L,ee)|0,n=n+Math.imul(R,er)|0,i=(i=i+Math.imul(R,en)|0)+Math.imul(P,er)|0,s=s+Math.imul(P,en)|0,n=n+Math.imul(M,es)|0,i=(i=i+Math.imul(M,eo)|0)+Math.imul(T,es)|0,s=s+Math.imul(T,eo)|0,n=n+Math.imul(A,eu)|0,i=(i=i+Math.imul(A,el)|0)+Math.imul(B,eu)|0,s=s+Math.imul(B,el)|0,n=n+Math.imul(k,ef)|0,i=(i=i+Math.imul(k,eh)|0)+Math.imul(S,ef)|0,s=s+Math.imul(S,eh)|0,n=n+Math.imul(w,ep)|0;var eI=(l+n|0)+((8191&(i=(i=i+Math.imul(w,em)|0)+Math.imul(_,ep)|0))<<13)|0;l=((s=s+Math.imul(_,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=0x3ffffff,n=Math.imul(j,Q),i=(i=Math.imul(j,ee))+Math.imul(z,Q)|0,s=Math.imul(z,ee),n=n+Math.imul(U,er)|0,i=(i=i+Math.imul(U,en)|0)+Math.imul(L,er)|0,s=s+Math.imul(L,en)|0,n=n+Math.imul(R,es)|0,i=(i=i+Math.imul(R,eo)|0)+Math.imul(P,es)|0,s=s+Math.imul(P,eo)|0,n=n+Math.imul(M,eu)|0,i=(i=i+Math.imul(M,el)|0)+Math.imul(T,eu)|0,s=s+Math.imul(T,el)|0,n=n+Math.imul(A,ef)|0,i=(i=i+Math.imul(A,eh)|0)+Math.imul(B,ef)|0,s=s+Math.imul(B,eh)|0,n=n+Math.imul(k,ep)|0;var eM=(l+n|0)+((8191&(i=(i=i+Math.imul(k,em)|0)+Math.imul(S,ep)|0))<<13)|0;l=((s=s+Math.imul(S,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=0x3ffffff,n=Math.imul(j,er),i=(i=Math.imul(j,en))+Math.imul(z,er)|0,s=Math.imul(z,en),n=n+Math.imul(U,es)|0,i=(i=i+Math.imul(U,eo)|0)+Math.imul(L,es)|0,s=s+Math.imul(L,eo)|0,n=n+Math.imul(R,eu)|0,i=(i=i+Math.imul(R,el)|0)+Math.imul(P,eu)|0,s=s+Math.imul(P,el)|0,n=n+Math.imul(M,ef)|0,i=(i=i+Math.imul(M,eh)|0)+Math.imul(T,ef)|0,s=s+Math.imul(T,eh)|0,n=n+Math.imul(A,ep)|0;var eT=(l+n|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(B,ep)|0))<<13)|0;l=((s=s+Math.imul(B,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=0x3ffffff,n=Math.imul(j,es),i=(i=Math.imul(j,eo))+Math.imul(z,es)|0,s=Math.imul(z,eo),n=n+Math.imul(U,eu)|0,i=(i=i+Math.imul(U,el)|0)+Math.imul(L,eu)|0,s=s+Math.imul(L,el)|0,n=n+Math.imul(R,ef)|0,i=(i=i+Math.imul(R,eh)|0)+Math.imul(P,ef)|0,s=s+Math.imul(P,eh)|0,n=n+Math.imul(M,ep)|0;var eO=(l+n|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(T,ep)|0))<<13)|0;l=((s=s+Math.imul(T,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=0x3ffffff,n=Math.imul(j,eu),i=(i=Math.imul(j,el))+Math.imul(z,eu)|0,s=Math.imul(z,el),n=n+Math.imul(U,ef)|0,i=(i=i+Math.imul(U,eh)|0)+Math.imul(L,ef)|0,s=s+Math.imul(L,eh)|0,n=n+Math.imul(R,ep)|0;var eR=(l+n|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(P,ep)|0))<<13)|0;l=((s=s+Math.imul(P,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=0x3ffffff,n=Math.imul(j,ef),i=(i=Math.imul(j,eh))+Math.imul(z,ef)|0,s=Math.imul(z,eh),n=n+Math.imul(U,ep)|0;var eP=(l+n|0)+((8191&(i=(i=i+Math.imul(U,em)|0)+Math.imul(L,ep)|0))<<13)|0;l=((s=s+Math.imul(L,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=0x3ffffff,n=Math.imul(j,ep);var eC=(l+n|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(z,ep)|0))<<13)|0;return l=((s=Math.imul(z,em))+(i>>>13)|0)+(eC>>>26)|0,eC&=0x3ffffff,u[0]=eg,u[1]=ey,u[2]=eb,u[3]=ev,u[4]=ew,u[5]=e_,u[6]=ex,u[7]=ek,u[8]=eS,u[9]=eE,u[10]=eA,u[11]=eB,u[12]=eI,u[13]=eM,u[14]=eT,u[15]=eO,u[16]=eR,u[17]=eP,u[18]=eC,0!==l&&(u[19]=l,r.length++),r};function g(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=0x3ffffff&n,u=Math.min(s,t.length-1),l=Math.max(0,s-e.length+1);l<=u;l++){var c=s-l,f=(0|e.words[c])*(0|t.words[l]),h=0x3ffffff&f;o=o+(f/0x4000000|0)|0,a=0x3ffffff&(h=h+a|0),i+=(o=o+(h>>>26)|0)>>>26,o&=0x3ffffff}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function y(e,t){this.x=e,this.y=t}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return 10===this.length&&10===e.length?r=m(this,e,t):n<63?r=p(this,e,t):r=g(this,e,t),r},y.prototype.makeRBT=function(e){for(var t=Array(e),r=i.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o<s;o++)n[o]=t[e[o]],i[o]=r[e[o]]},y.prototype.transform=function(e,t,r,n,i,s){this.permute(s,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),c=0;c<i;c+=a)for(var f=u,h=l,d=0;d<o;d++){var p=r[c+d],m=n[c+d],g=r[c+d+o],y=n[c+d+o],b=f*g-h*y;y=f*y+h*g,g=b,r[c+d]=p+g,n[c+d]=m+y,r[c+d+o]=p-g,n[c+d+o]=m-y,d!==a&&(b=u*f-l*h,h=u*h+l*f,f=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=0x3ffffff&i,r=i<0x4000000?0:i/0x4000000|0}return e},y.prototype.convert13b=function(e,t,n,i){for(var s=0,o=0;o<t;o++)s+=0|e[o],n[2*o]=8191&s,s>>>=13,n[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0===s),r((-8192&s)==0)},y.prototype.stub=function(e){for(var t=Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),s=this.stub(n),o=Array(n),a=Array(n),u=Array(n),l=Array(n),c=Array(n),f=Array(n),h=r.words;h.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,l,n),this.transform(o,s,a,u,n,i),this.transform(l,s,c,f,n,i);for(var d=0;d<n;d++){var p=a[d]*c[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*c[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,h,s,n,i),this.conjugate(h,s,n),this.normalize13b(h,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(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<0x4000000);for(var n=0,i=0;i<this.length;i++){var s=(0|this.words[i])*e,o=(0x3ffffff&s)+(0x3ffffff&n);n>>=26,n+=(s/0x4000000|0)+(o>>>26),this.words[i]=0x3ffffff&o}return 0!==n&&(this.words[i]=n,this.length++),this.length=0===e?1: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=Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var s=r.sqr();n<t.length;n++,s=s.sqr())0!==t[n]&&(r=r.mul(s));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,s=0x3ffffff>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,u=(0|this.words[t])-a<<n;this.words[t]=u|o,o=a>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){r("number"==typeof e&&e>=0);var i=t?(t-t%26)/26:0,s=e%26,o=Math.min((e-s)/26,this.length),a=0x3ffffff^0x3ffffff>>>s<<s;if(i-=o,i=Math.max(0,i),n){for(var u=0;u<o;u++)n.words[u]=this.words[u];n.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-s|c>>>s,l=c&a}return n&&0!==l&&(n.words[n.length++]=l),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;return!(this.length<=n)&&!!(this.words[n]&1<<t)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;return(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)?this:(0!==t&&n++,this.length=Math.min(n,this.length),0!==t&&(this.words[this.length-1]&=0x3ffffff^0x3ffffff>>>t<<t),this._strip())},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return(r("number"==typeof e),r(e<0x4000000),e<0)?this.isubn(-e):0!==this.negative?(1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(e),this.negative=1),this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=0x4000000;t++)this.words[t]-=0x4000000,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<0x4000000),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<this.length&&this.words[t]<0;t++)this.words[t]+=0x4000000,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,s,o=e.length+n;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;s-=0x3ffffff&u,a=(s>>26)-(u/0x4000000|0),this.words[i+n]=0x3ffffff&s}for(;i<this.length-n;i++)a=(s=(0|this.words[i+n])+a)>>26,this.words[i+n]=0x3ffffff&s;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=0x3ffffff&s;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r,n=this.length-e.length,s=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),s.iushln(n),a=0|o.words[o.length-1]);var u=s.length-o.length;if("mod"!==t){(r=new i(null)).length=u+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var c=s.clone()._ishlnsubmul(o,1,u);0===c.negative&&(s=c,r&&(r.words[u]=1));for(var f=u-1;f>=0;f--){var h=(0|s.words[o.length+f])*0x4000000+(0|s.words[o.length+f-1]);for(h=Math.min(h/a|0,0x3ffffff),s._ishlnsubmul(o,h,f);0!==s.negative;)h--,s.negative=0,s._ishlnsubmul(o,1,f),s.isZero()||(s.negative^=1);r&&(r.words[f]=h)}return r&&r._strip(),s._strip(),"div"!==t&&0!==n&&s.iushrn(n),{div:r||null,mod:s}},i.prototype.divmod=function(e,t,n){var s,o,a;return(r(!e.isZero()),this.isZero())?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(s=a.div.neg()),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:s,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(s=a.div.neg()),{div:s,mod:a.mod}):(this.negative&e.negative)!=0?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||0>this.cmp(e)?{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)},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),s=r.cmp(n);return s<0||1===i&&0===s?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<=0x3ffffff);for(var n=0x4000000%e,i=0,s=this.length-1;s>=0;s--)i=(n*i+(0|this.words[s]))%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<=0x3ffffff);for(var n=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+0x4000000*n;this.words[i]=s/e|0,n=s%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 s=new i(1),o=new i(0),a=new i(0),u=new i(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),f=t.clone();!t.isZero();){for(var h=0,d=1;(t.words[0]&d)==0&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(c),o.isub(f)),s.iushrn(1),o.iushrn(1);for(var p=0,m=1;(n.words[0]&m)==0&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(f)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a),o.isub(u)):(n.isub(t),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(l)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,s=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var o=new i(1),a=new i(0),u=s.clone();n.cmpn(1)>0&&s.cmpn(1)>0;){for(var l=0,c=1;(n.words[0]&c)==0&&l<26;++l,c<<=1);if(l>0)for(n.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var f=0,h=1;(s.words[0]&h)==0&&f<26;++f,h<<=1);if(f>0)for(s.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);n.cmp(s)>=0?(n.isub(s),o.isub(a)):(s.isub(n),a.isub(o))}return 0>(t=0===n.cmpn(1)?o:a).cmpn(0)&&t.iadd(e),t},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 s=t;t=r,r=s}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(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},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<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var s=i,o=n;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=0x3ffffff,this.words[o]=a}return 0!==s&&(this.words[o]=s,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<=0x3ffffff,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return -1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return -1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},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 S(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 b={k256:null,p224:null,p192:null,p25519:null};function v(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 w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(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 E(e){S.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)}v.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},v.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=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n<r;n++)t.words[n]=e.words[n];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var i=e.words[9];for(n=10,t.words[t.length++]=4194303&i;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(4194303&s)<<4|i>>>22,i=s}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},w.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<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=0x3ffffff&t,t=64*n+(t/0x4000000|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(x,v),n(k,v),k.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;
1r++){var n=(0|e.words[r])*19+t,i=0x3ffffff&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(b[e])return b[e];if("k256"===e)t=new w;else if("p224"===e)t=new _;else if("p192"===e)t=new x;else if("p25519"===e)t=new k;else throw Error("Unknown prime "+e);return b[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r((e.negative|t.negative)==0,"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.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)},S.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},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.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 s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,s),h=this.pow(e,s.addn(1).iushrn(1)),d=this.pow(e,s),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(f,new i(1).iushln(p-g-1));h=h.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return h},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var s=r[0],o=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var l=t.words[n],c=u-1;c>=0;c--){var f=l>>c&1;if(s!==r[0]&&(s=this.sqr(s)),0===f&&0===o){a=0;continue}o<<=1,o|=f,(4==++a||0===n&&0===c)&&(s=this.mul(s,r[o]),a=0,o=0)}u=26}return s},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},n(E,S),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):0>i.cmpn(0)&&(s=i.iadd(this.m)),s._forceRed(this)},E.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),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):0>s.cmpn(0)&&(o=s.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e.e)},42524,(e,t,r)=>{var n=e.r(43943),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(s(n,r),r.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},50889,(e,t,r)=>{"use strict";var n=e.r(42524).Buffer;t.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=i}var a=e.length,u=e.charAt(0),l=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return n.alloc(0);for(var r=0,i=0,s=0;e[r]===u;)i++,r++;for(var o=(e.length-r)*l+1>>>0,c=new Uint8Array(o);r<e.length;){var f=e.charCodeAt(r);if(f>255)return;var h=t[f];if(255===h)return;for(var d=0,p=o-1;(0!==h||d<s)&&-1!==p;p--,d++)h+=a*c[p]>>>0,c[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");s=d,r++}for(var m=o-s;m!==o&&0===c[m];)m++;var g=n.allocUnsafe(i+(o-m));g.fill(0,0,i);for(var y=i;m!==o;)g[y++]=c[m++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var l=(o-s)*c+1>>>0,f=new Uint8Array(l);s!==o;){for(var h=t[s],d=0,p=l-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*f[p]>>>0,f[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,s++}for(var m=l-i;m!==l&&0===f[m];)m++;for(var g=u.repeat(r);m<l;++m)g+=e.charAt(f[m]);return g},decodeUnsafe:f,decode:function(e){var t=f(e);
1if(t)return t;throw Error("Non-base"+a+" character")}}}},54611,(e,t,r)=>{t.exports=e.r(50889)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},67034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=u(e),o=s[0],a=s[1],l=new i((o+a)*3/4-a),c=0,f=a>0?o-4:o;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;o<a;o+=16383)s.push(function(e,t,n){for(var i,s=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|d(n,i),u=o(s),l=u.write(n,i);return l!==s&&(u=u.slice(0,l)),u}if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(M(e,ArrayBuffer)||e&&M(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(M(e,SharedArrayBuffer)||e&&M(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return a.from(c,t,r);var p=function(e){if(a.isBuffer(e)){var t=0|h(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(p)return p;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),o(e<0?0:0|h(e))}function f(e){for(var t=e.length<0?0:0|h(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(l(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||M(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(i)return n?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var i,s,o,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=T[e[s]];return i}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,s=t,o=r,0===s&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var s,o=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=r;s<a;s++)if(l(e,s)===l(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===u)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){for(var f=!0,h=0;h<u;h++)if(l(e,s+h)!==l(t,h)){f=!1;break}if(f)return s}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(M(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),M(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!
vendor: 11,979 bytes, line 1
1a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(M(s,Uint8Array)&&(s=a.from(s)),!a.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):p.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(M(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,o=r-t,u=Math.min(s,o),l=this.slice(n,i),c=e.slice(t,r),f=0;f<u;++f)if(l[f]!==c[f]){s=l[f],o=c[f];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function b(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,o,a,u,l=e[i],c=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:(192&(s=e[i+1]))==128&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=e[i+1],o=e[i+2],(192&s)==128&&(192&o)==128&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,d=h.length;if(d<=4096)return String.fromCharCode.apply(String,h);for(var p="",m=0;m<d;)p+=String.fromCharCode.apply(String,h.slice(m,m+=4096));return p}function v(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function _(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function x(e,t,r,n,s){return t*=1,r>>>=0,s||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,s){return t*=1,r>>>=0,s||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,o,a,u,l,c,f,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a,u=parseInt(t.substr(2*o,2),16);if((a=u)!=a)break;e[r+o]=u}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,I(E(e,this.length-i),this,i,s);case"ascii":return o=t,a=r,I(A(e),this,o,a);case"latin1":case"binary":return function(e,t,r,n){return I(A(t),e,r,n)}(this,e,t,r);case"base64":return u=t,l=r,I(B(e),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,f=r,I(function(e,t){for(var r,n,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,f);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var s=1,o=0;for(this[t]=255&e;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var s=i-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=a.isBuffer(e)?e:a.from(e,n),u=o.length;
1if(0===u)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%u]}return this};var S=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function A(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function B(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function M(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var T=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,u=(1<<a)-1,l=u>>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=256*s+e[t+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),s-=l}return(d?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,u,l=8*s-i-1,c=(1<<l)-1,f=c>>1,h=5960464477539062e-23*(23===i),d=n?0:s-1,p=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+f>=1?t+=h/u:t+=h*Math.pow(2,1-f),t*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(t*u-1)*Math.pow(2,i),o+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;e[r+d]=255&o,d+=p,o/=256,l-=8);e[r+d-p]|=128*m}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},o=!0;try{n[e](r,r.exports,s),o=!1}finally{o&&delete i[e]}return r.exports}s.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=s(72)},72766,(e,t,r)=>{"use strict";function n(e,t,r){return t<=e&&e<=r}function i(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function s(e){this.tokens=[].slice.call(e)}function o(e,t){if(e)throw TypeError("Decoder error");return t||65533}s.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.push(e.shift());else this.tokens.push(e)}};var a="utf-8";function u(e,t){if(!(this instanceof u))return new u(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw Error("Encoding not supported. Only utf-8 is supported");t=i(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function l(e,t){if(!(this instanceof l))return new l(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw Error("Encoding not supported. Only utf-8 is supported");t=i(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function c(e){var t=e.fatal,r=0,i=0,s=0,a=128,u=191;this.handler=function(e,l){if(-1===l&&0!==s)return s=0,o(t);if(-1===l)return -1;if(0===s){if(n(l,0,127))return l;if(n(l,194,223))s=1,r=l-192;else if(n(l,224,239))224===l&&(a=160),237===l&&(u=159),s=2,r=l-224;else{if(!n(l,240,244))return o(t);
1240===l&&(a=144),244===l&&(u=143),s=3,r=l-240}return r<<=6*s,null}if(!n(l,a,u))return r=s=i=0,a=128,u=191,e.prepend(l),o(t);if(a=128,u=191,i+=1,r+=l-128<<6*(s-i),i!==s)return null;var c=r;return r=s=i=0,c}}function f(e){e.fatal,this.handler=function(e,t){if(-1===t)return -1;if(n(t,0,127))return t;n(t,128,2047)?(r=1,i=192):n(t,2048,65535)?(r=2,i=224):n(t,65536,1114111)&&(r=3,i=240);for(var r,i,s=[(t>>6*r)+i];r>0;){var o=t>>6*(r-1);s.push(128|63&o),r-=1}return s}}u.prototype={decode:function(e,t){r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=i(t),this._streaming||(this._decoder=new c({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var r,n,o=new s(r),a=[];!o.endOfStream()&&-1!==(n=this._decoder.handler(o,o.read()));)null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n));if(!this._streaming){do{if(-1===(n=this._decoder.handler(o,o.read())))break;if(null===n)continue;Array.isArray(n)?a.push.apply(a,n):a.push(n)}while(!o.endOfStream())this._decoder=null}!a.length||-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===a[0]?(this._BOMseen=!0,a.shift()):this._BOMseen=!0);for(var u="",l=0;l<a.length;++l){var f=a[l];f<=65535?u+=String.fromCharCode(f):(f-=65536,u+=String.fromCharCode((f>>10)+55296,(1023&f)+56320))}return u}},l.prototype={encode:function(e,t){e=e?String(e):"",t=i(t),this._streaming||(this._encoder=new f(this._options)),this._streaming=!!t.stream;for(var r,n=[],o=new s(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var s=t.charCodeAt(n);if(s<55296||s>57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(n===r-1)i.push(65533);else{var o=e.charCodeAt(n+1);if(56320<=o&&o<=57343){var a=1023&s,u=1023&o;i.push(65536+(a<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e));!o.endOfStream()&&-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?n.push.apply(n,r):n.push(r);if(!this._streaming){for(;-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?n.push.apply(n,r):n.push(r);this._encoder=null}return new Uint8Array(n)}},r.TextEncoder=l,r.TextDecoder=u},54119,(e,t,r)=>{"use strict";var n=e.i(67034),i=e.e&&e.e.__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]}),s=e.e&&e.e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e.e&&e.e.__decorate||function(e,t,r,n){var i,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},a=e.e&&e.e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&i(t,e,r);return s(t,e),t},u=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.deserializeUnchecked=r.deserialize=r.serialize=r.BinaryReader=r.BinaryWriter=r.BorshError=r.baseDecode=r.baseEncode=void 0;let l=u(e.r(16853)),c=u(e.r(54611)),f=a(e.r(72766)),h=new("function"!=typeof TextDecoder?f.TextDecoder:TextDecoder)("utf-8",{fatal:!0});r.baseEncode=function(e){return"string"==typeof e&&(e=n.Buffer.from(e,"utf8")),c.default.encode(n.Buffer.from(e))},r.baseDecode=function(e){return n.Buffer.from(c.default.decode(e))};class d extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}r.BorshError=d;class p{constructor(){this.buf=n.Buffer.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=n.Buffer.concat([this.buf,n.Buffer.alloc(1024)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(n.Buffer.from(new l.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(n.Buffer.from(new l.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(n.Buffer.from(new l.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(n.Buffer.from(new l.default(e).toArray("le",64)))}writeBuffer(e){this.buf=n.Buffer.concat([n.Buffer.from(this.buf.subarray(0,this.length)),e,n.Buffer.alloc(1024)]),this.length+=e.length}writeString(e){this.maybeResize();let t=n.Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(n.Buffer.from(e))}writeArray(e,t){for(let r of(this.maybeResize(),this.writeU32(e.length),e))this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}}function m(e,t,r){let n=r.value;r.value=function(...e){try{return n.apply(this,e)}catch(e){if(e instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e.code)>=0)throw new d("Reached the end of buffer when deserializing");throw e}}}r.BinaryWriter=p;class g{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new l.default(e,"le")}readU128(){let e=this.readBuffer(16);return new l.default(e,"le")}readU256(){let e=this.readBuffer(32);return new l.default(e,"le")}readU512(){let e=this.readBuffer(64);return new l.default(e,"le")}readBuffer(e){if(this.offset+e>
vendor: 5,250 bytes, line 1
1this.buf.length)throw new d(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return h.decode(t)}catch(e){throw new d(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=[];for(let n=0;n<t;++n)r.push(e());return r}}function y(e){return e.charAt(0).toUpperCase()+e.slice(1)}function b(e,t,r,n,i){try{if("string"==typeof n)i[`write${y(n)}`](r);else if(n instanceof Array)if("number"==typeof n[0]){if(r.length!==n[0])throw new d(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(2===n.length&&"number"==typeof n[1]){if(r.length!==n[1])throw new d(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let t=0;t<n[1];t++)b(e,null,r[t],n[0],i)}else i.writeArray(r,r=>{b(e,t,r,n[0],i)});else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),b(e,t,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,s)=>{b(e,t,s,n.key,i),b(e,t,r,n.value,i)});break;default:throw new d(`FieldType ${n} unrecognized`)}else v(e,r,i)}catch(e){throw e instanceof d&&e.addToFieldPath(t),e}}function v(e,t,r){if("function"==typeof t.borshSerialize)return void t.borshSerialize(r);let n=e.get(t.constructor);if(!n)throw new d(`Class ${t.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map(([n,i])=>{b(e,n,t[n],i,r)});else if("enum"===n.kind){let i=t[n.field];for(let s=0;s<n.values.length;++s){let[o,a]=n.values[s];if(o===i){r.writeU8(s),b(e,o,t[o],a,r);break}}}else throw new d(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}function w(e,t,r,n){try{if("string"==typeof r)return n[`read${y(r)}`]();if(r instanceof Array)if("number"==typeof r[0])return n.readFixedArray(r[0]);else{if("number"!=typeof r[1])return n.readArray(()=>w(e,t,r[0],n));let i=[];for(let t=0;t<r[1];t++)i.push(w(e,null,r[0],n));return i}if("option"===r.kind){if(n.readU8())return w(e,t,r.type,n);return}if("map"===r.kind){let i=new Map,s=n.readU32();for(let o=0;o<s;o++){let s=w(e,t,r.key,n),o=w(e,t,r.value,n);i.set(s,o)}return i}return _(e,r,n)}catch(e){throw e instanceof d&&e.addToFieldPath(t),e}}function _(e,t,r){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(r);let n=e.get(t);if(!n)throw new d(`Class ${t.name} is missing in schema`);if("struct"===n.kind){let n={};for(let[i,s]of e.get(t).fields)n[i]=w(e,i,s,r);return new t(n)}if("enum"===n.kind){let i=r.readU8();if(i>=n.values.length)throw new d(`Enum index: ${i} is out of range`);let[s,o]=n.values[i],a=w(e,s,o,r);return new t({[s]:a})}throw new d(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}o([m],g.prototype,"readU8",null),o([m],g.prototype,"readU16",null),o([m],g.prototype,"readU32",null),o([m],g.prototype,"readU64",null),o([m],g.prototype,"readU128",null),o([m],g.prototype,"readU256",null),o([m],g.prototype,"readU512",null),o([m],g.prototype,"readString",null),o([m],g.prototype,"readFixedArray",null),o([m],g.prototype,"readArray",null),r.BinaryReader=g,r.serialize=function(e,t,r=p){let n=new r;return v(e,t,n),n.toArray()},r.deserialize=function(e,t,r,n=g){let i=new n(r),s=_(e,t,i);if(i.offset<r.length)throw new d(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return s},r.deserializeUnchecked=function(e,t,r,n=g){return _(e,t,new n(r))}},44610,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.s16=r.s8=r.nu64be=r.u48be=r.u40be=r.u32be=r.u24be=r.u16be=r.nu64=r.u48=r.u40=r.u32=r.u24=r.u16=r.u8=r.offset=r.greedy=r.Constant=r.UTF8=r.CString=r.Blob=r.Boolean=r.BitField=r.BitStructure=r.VariantLayout=r.Union=r.UnionLayoutDiscriminator=r.UnionDiscriminator=r.Structure=r.Sequence=r.DoubleBE=r.Double=r.FloatBE=r.Float=r.NearInt64BE=r.NearInt64=r.NearUInt64BE=r.NearUInt64=r.IntBE=r.Int=r.UIntBE=r.UInt=r.OffsetLayout=r.GreedyCount=r.ExternalLayout=r.bindConstructorLayout=r.nameWithProperty=r.Layout=r.uint8ArrayToBuffer=r.checkUint8Array=void 0,r.constant=r.utf8=r.cstr=r.blob=r.unionLayoutDiscriminator=r.union=r.seq=r.bits=r.struct=r.f64be=r.f64=r.f32be=r.f32=r.ns64be=r.s48be=r.s40be=r.s32be=r.s24be=r.s16be=r.ns64=r.s48=r.s40=r.s32=r.s24=void 0;let n=e.r(43943);function i(e){if(!(e instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(e){return i(e),n.Buffer.from(e.buffer,e.byteOffset,e.length)}r.checkUint8Array=i,r.uint8ArrayToBuffer=s;class o{constructor(e,t){if(!Number.isInteger(e))throw TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function a(e,t){return t.property?e+"["+t.property+"]":e}r.Layout=o,r.nameWithProperty=a,r.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw Error("Class is already bound to a layout");if(!(t&&t instanceof o))throw TypeError("layout must be a Layout");
1if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,r)=>t.decode(e,r),writable:!0})};class u extends o{isCount(){throw Error("ExternalLayout is abstract")}}r.ExternalLayout=u;class l extends u{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){return i(e),Math.floor((e.length-t)/this.elementSpan)}encode(e,t,r){return 0}}r.GreedyCount=l;class c extends u{constructor(e,t=0,r){if(!(e instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(t))throw TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof f||this.layout instanceof h}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}r.OffsetLayout=c;class f extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntLE(e,r,this.span),this.span}}r.UInt=f;class h extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntBE(e,r,this.span),this.span}}r.UIntBE=h;class d extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeIntLE(e,r,this.span),this.span}}r.Int=d;class p extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeIntBE(e,r,this.span),this.span}}function m(e){let t=Math.floor(e/0x100000000);return{hi32:t,lo32:e-0x100000000*t}}function g(e,t){return 0x100000000*e+t}r.IntBE=p;class y extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),n=r.readUInt32LE(t);return g(r.readUInt32LE(t+4),n)}encode(e,t,r=0){let n=m(e),i=s(t);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}r.NearUInt64=y;class b extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e);return g(r.readUInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){let n=m(e),i=s(t);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}r.NearUInt64BE=b;class v extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),n=r.readUInt32LE(t);return g(r.readInt32LE(t+4),n)}encode(e,t,r=0){let n=m(e),i=s(t);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}r.NearInt64=v;class w extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e);return g(r.readInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){let n=m(e),i=s(t);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}r.NearInt64BE=w;class _ extends o{constructor(e){super(4,e)}decode(e,t=0){return s(e).readFloatLE(t)}encode(e,t,r=0){return s(t).writeFloatLE(e,r),4}}r.Float=_;class x extends o{constructor(e){super(4,e)}decode(e,t=0){return s(e).readFloatBE(t)}encode(e,t,r=0){return s(t).writeFloatBE(e,r),4}}r.FloatBE=x;class k extends o{constructor(e){super(8,e)}decode(e,t=0){return s(e).readDoubleLE(t)}encode(e,t,r=0){return s(t).writeDoubleLE(e,r),8}}r.Double=k;class S extends o{constructor(e){super(8,e)}decode(e,t=0){return s(e).readDoubleBE(t)}encode(e,t,r=0){return s(t).writeDoubleBE(e,r),8}}r.DoubleBE=S;class E extends o{constructor(e,t,r){if(!(e instanceof o))throw TypeError("elementLayout must be a Layout");if(!(t instanceof u&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;t instanceof u||!(0<e.span)||(n=t*e.span),super(n,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof u&&(n=n.decode(e,t)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(e,t+r),++i}return r}decode(e,t=0){let r=[],n=0,i=this.count;for(i instanceof u&&(i=i.decode(e,t));n<i;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),n+=1;return r}encode(e,t,r=0){let n=this.elementLayout,i=e.reduce((e,i)=>e+n.encode(i,t,r+e),0);return this.count instanceof u&&this.count.encode(e.length,t,r),i}}r.Sequence=E;class A extends o{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((e,t)=>
1e&&t instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(const n of("boolean"==typeof t&&void 0===r&&(r=t,t=void 0),e))if(0>n.span&&void 0===n.property)throw Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{let i=n.getSpan(e,t);return t+=i,r+i},0)}catch(e){throw RangeError("indeterminate span")}return r}decode(e,t=0){i(e);let r=this.makeDestinationObject();for(let n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let n=r,i=0,s=0;for(let n of this.fields){let o=n.span;if(s=0<o?o:0,void 0!==n.property){let i=e[n.property];void 0!==i&&(s=n.encode(i,t,r),0>o&&(o=n.getSpan(t,r)))}i=r,r+=o}return i+s-n}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}r.Structure=A;class B{constructor(e){this.property=e}decode(e,t){throw Error("UnionDiscriminator is abstract")}encode(e,t,r){throw Error("UnionDiscriminator is abstract")}}r.UnionDiscriminator=B;class I extends B{constructor(e,t){if(!(e instanceof u&&e.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}r.UnionLayoutDiscriminator=I;class M extends o{constructor(e,t,r){let n;if(e instanceof f||e instanceof h)n=new I(new c(e));else if(e instanceof u&&e.isCount())n=new I(e);else if(e instanceof B)n=e;else throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof o))throw TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&0<=(i=t.span)&&(e instanceof f||e instanceof h)&&(i+=n.layout.span),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=e instanceof f||e instanceof h,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return s(e)},this.configGetSourceVariant=function(e){s=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw Error("unable to infer src variant")}decode(e,t=0){let r,n=this.discriminator,i=n.decode(e,t),s=this.registry[i];if(void 0===s){let s=this.defaultLayout,o=0;this.usesPrefixDiscriminator&&(o=n.layout.span),(r=this.makeDestinationObject())[n.property]=i,r[s.property]=s.decode(e,t+o)}else r=s.decode(e,t);return r}encode(e,t,r=0){let n=this.getSourceVariant(e);if(void 0===n){let n=this.discriminator,i=this.defaultLayout,s=0;return this.usesPrefixDiscriminator&&(s=n.layout.span),n.encode(e[n.property],t,r),s+i.encode(e[i.property],t,r+s)}return n.encode(e,t,r)}addVariant(e,t,r){let n=new T(this,e,t,r);return this.registry[e]=n,n}getVariant(e,t=0){let r;return r=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[r]}}r.Union=M;class T extends o{constructor(e,t,r,n){if(!(e instanceof M))throw TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof o))throw TypeError("layout must be a Layout");
1if(null!==e.defaultLayout&&0<=r.span&&r.span>e.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof n)throw TypeError("variant must have a String property")}let i=e.span;0>e.span&&0<=(i=r?r.span:0)&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span),super(i,n),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(e,t+r)),r+n}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let i=n;if(this.layout&&(this.layout.encode(e[this.property],t,r+n),i+=this.layout.getSpan(t,r+n),0<=this.union.span&&i>this.union.span))throw Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function O(e){return 0>e&&(e+=0x100000000),e}r.VariantLayout=T;class R extends o{constructor(e,t,r){if(!(e instanceof f||e instanceof h))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let n=0;this._packedSetValue=function(e){return n=O(e),this},this._packedGetValue=function(){return n}}decode(e,t=0){let r=this.makeDestinationObject(),n=this.word.decode(e,t);for(let t of(this._packedSetValue(n),this.fields))void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){let n=this.word.decode(t,r);for(let t of(this._packedSetValue(n),this.fields))if(void 0!==t.property){let r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new P(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new C(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}}r.BitStructure=R;class P{constructor(e,t,r){if(!(e instanceof R))throw TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw TypeError("bits must be positive integer");const n=8*e.span,i=e.fields.reduce((e,t)=>e+t.bits,0);if(t+i>n)throw Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=0xffffffff),this.start=i,this.container.msb&&(this.start=n-i-t),this.wordMask=O(this.valueMask<<this.start),this.property=r}decode(e,t){return O(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==O(e&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=O(e<<this.start);this.container._packedSetValue(O(t&~this.wordMask)|r)}}r.BitField=P;class C extends P{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e*=1),super.encode(e)}}r.Boolean=C;class U extends o{constructor(e,t){if(!(e instanceof u&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof u||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),s(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof u&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw RangeError("encoding overruns Uint8Array");let i=s(e);return s(t).write(i.toString("hex"),r,n,"hex"),this.length instanceof u&&this.length.encode(n,t,r),n}}r.Blob=U;class L extends o{constructor(e){super(-1,e)}getSpan(e,t=0){i(e);let r=t;for(;r<e.length&&0!==e[r];)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return s(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));let i=n.Buffer.from(e,"utf8"),o=i.length;if(r+o>t.length)throw RangeError("encoding overruns Buffer");let a=s(t);return i.copy(a,r),a[r+o]=0,o+1}}r.CString=L;class N extends o{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return i(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw RangeError("text length exceeds maxSpan");return s(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));let i=n.Buffer.from(e,"utf8"),o=i.length;if(0<=this.maxSpan&&this.maxSpan<o)throw RangeError("text length exceeds maxSpan");if(r+o>t.length)throw RangeError("encoding overruns Buffer");return i.copy(s(t),r),o}}r.UTF8=N;class j extends o{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}}r.Constant=j,r.greedy=(e,t)=>new l(e,t),r.offset=(e,t,r)=>new c(e,t,r),r.u8=e=>
1new f(1,e),r.u16=e=>new f(2,e),r.u24=e=>new f(3,e),r.u32=e=>new f(4,e),r.u40=e=>new f(5,e),r.u48=e=>new f(6,e),r.nu64=e=>new y(e),r.u16be=e=>new h(2,e),r.u24be=e=>new h(3,e),r.u32be=e=>new h(4,e),r.u40be=e=>new h(5,e),r.u48be=e=>new h(6,e),r.nu64be=e=>new b(e),r.s8=e=>new d(1,e),r.s16=e=>new d(2,e),r.s24=e=>new d(3,e),r.s32=e=>new d(4,e),r.s40=e=>new d(5,e),r.s48=e=>new d(6,e),r.ns64=e=>new v(e),r.s16be=e=>new p(2,e),r.s24be=e=>new p(3,e),r.s32be=e=>new p(4,e),r.s40be=e=>new p(5,e),r.s48be=e=>new p(6,e),r.ns64be=e=>new w(e),r.f32=e=>new _(e),r.f32be=e=>new x(e),r.f64=e=>new k(e),r.f64be=e=>new S(e),r.struct=(e,t,r)=>new A(e,t,r),r.bits=(e,t,r)=>new R(e,t,r),r.seq=(e,t,r)=>new E(e,t,r),r.union=(e,t,r)=>new M(e,t,r),r.unionLayoutDiscriminator=(e,t)=>new I(e,t),r.blob=(e,t)=>new U(e,t),r.cstr=e=>new L(e),r.utf8=(e,t)=>new N(e,t),r.constant=(e,t)=>new j(e,t)},38340,85098,e=>{"use strict";function t([e,t]){return`${e}=${function e(t){return Array.isArray(t)?"%5B"+t.map(e).join("%2C%20")+"%5D":"bigint"==typeof t?`${t}n`:encodeURIComponent(String(null!=t&&null===Object.getPrototypeOf(t)?{...t}:t))}(t)}`}e.i(47167);var r,n=class extends Error{cause=this.cause;context;constructor(...[e,r]){let n,i;if(r){const{cause:e,...t}=r;e&&(i={cause:e}),Object.keys(t).length>0&&(n=t)}super(function(e,r={}){{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(r).length&&(n+=` '${btoa(Object.entries(r).map(t).join("&"))}'`),`${n}\``}}(e,n),i),this.context={__code:e,...n},this.name="SolanaError"}};function i(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}var s=((r=s||{})[r.Little=0]="Little",r[r.Big=1]="Big",r);function o(e){return e?.endian!==1}var a=(e={})=>{var t,r;return Object.freeze({...r={fixedSize:(t={config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}).size,write(e,r,i){t.range&&function(e,t,r,i){if(i<t||i>r)throw new n(8078011,{codecDescription:e,max:r,min:t,value:i})}(t.name,t.range[0],t.range[1],e);let s=new ArrayBuffer(t.size);return t.set(new DataView(s),e,o(t.config)),r.set(new Uint8Array(s),i),i+t.size}},encode:e=>{let t=new Uint8Array("fixedSize"in r?r.fixedSize:r.getSizeFromValue(e));return r.write(e,t,0),t}})},u=(e={})=>(function(e,t){if(i(e)!==i(t))throw new n(8078004);if(i(e)&&i(t)&&e.fixedSize!==t.fixedSize)throw new n(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!i(e)&&!i(t)&&e.maxSize!==t.maxSize)throw new n(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}})(a(e),((e={})=>{var t,r;return Object.freeze({...r={fixedSize:(t={config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}).size,read(e,r=0){var i,s,a;let u,l;!function(e,t,r=0){if(t.length-r<=0)throw new n(8078e3,{codecDescription:e})}(t.name,e,r),function(e,t,r,i=0){let s=r.length-i;if(s<t)throw new n(8078001,{bytesLength:s,codecDescription:e,expected:t})}(t.name,t.size,e,r);let c=new DataView((i=e,s=r,a=t.size,u=i.byteOffset+(s??0),l=a??i.byteLength,i.buffer.slice(u,u+l)));return[t.get(c,o(t.config)),r+t.size]}},decode:(e,t=0)=>r.read(e,t)[0]})})(e));e.s(["getU64Codec",()=>u,"getU64Encoder",()=>a],38340);class l extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...s}=e,{path:o}=e,a=0===o.length?n:`At path: ${o.join(".")} -- ${n}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function c(e){return"object"==typeof e&&null!=e}function f(e){return c(e)&&!Array.isArray(e)}function h(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*d(e,t,r,n){var i;for(let s of(c(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:u=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${h(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:u}}(s,t,r,n);e&&(yield e)}}function*p(e,t,r={}){let{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i,mask:o};s&&(e=t.coercer(e,a));let u="valid";for(let n of t.validator(e,a))n.explanation=r.message,u="not_val
1id",yield[n,void 0];for(let[l,f,h]of t.entries(e,a))for(let t of p(f,h,{path:void 0===l?n:[...n,l],branch:void 0===l?i:[...i,f],coerce:s,mask:o,message:r.message}))t[0]?(u=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):s&&(f=t[1],void 0===l?e=f:e instanceof Map?e.set(l,f):e instanceof Set?e.add(f):c(e)&&(void 0!==f||l in e)&&(e[l]=f));if("not_valid"!==u)for(let n of t.refiner(e,a))n.explanation=r.message,u="not_refined",yield[n,void 0];"valid"===u&&(yield[void 0,e])}class m{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:s=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,n?this.validator=(e,t)=>d(n(e,t),t,this,e):this.validator=()=>[],i?this.refiner=(e,t)=>d(i(e,t),t,this,e):this.refiner=()=>[]}assert(e,t){return g(e,this,t)}create(e,t){return y(e,this,t)}is(e){var t,r;return t=e,r=this,!b(t,r)[0]}mask(e,t){var r=e,n=this,i=t;let s=b(r,n,{coerce:!0,mask:!0,message:i});if(!s[0])return s[1];throw s[0]}validate(e,t={}){return b(e,this,t)}}function g(e,t,r){let n=b(e,t,{message:r});if(n[0])throw n[0]}function y(e,t,r){let n=b(e,t,{coerce:!0,message:r});if(!n[0])return n[1];throw n[0]}function b(e,t,r={}){let n=p(e,t,r),i=function(e){let{done:t,value:r}=e.next();return t?void 0:r}(n);return i[0]?[new l(i[0],function*(){for(let e of n)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function v(e,t){return new m({type:e,schema:null,validator:t})}function w(){return v("any",()=>!0)}function _(e){return new m({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${h(e)}`})}function x(){return v("boolean",e=>"boolean"==typeof e)}function k(e){return v("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${h(t)}`)}function S(e){let t=h(e),r=typeof e;return new m({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${h(r)}`})}function E(e){return new m({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function A(){return v("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${h(e)}`)}function B(e){return new m({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function I(e,t){return new m({type:"record",schema:null,*entries(r){if(c(r))for(let n in r){let i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>f(e)||`Expected an object, but received: ${h(e)}`,coercer:e=>f(e)?{...e}:e})}function M(){return v("string",e=>"string"==typeof e||`Expected a string, but received: ${h(e)}`)}function T(e){let t=v("never",()=>!1);return new m({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${h(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function O(e){let t=Object.keys(e);return new m({type:"type",schema:e,*entries(r){if(c(r))for(let n of t)yield[n,r[n],e[n]]},validator:e=>f(e)||`Expected an object, but received: ${h(e)}`,coercer:e=>f(e)?{...e}:e})}function R(e){let t=e.map(e=>e.type).join(" | ");return new m({type:"union",schema:null,coercer(t,r){for(let n of e){let[e,i]=n.validate(t,{coerce:!0,mask:r.mask});if(!e)return i}return t},validator(r,n){let i=[];for(let t of e){let[...e]=p(r,t,n),[s]=e;if(!s[0])return[];for(let[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${h(r)}`,...i]}})}function P(){return v("unknown",()=>!0)}function C(e,t,r){return new m({...e,coercer:(n,i)=>b(n,t)[0]?e.coercer(n,i):e.coercer(r(n,i),i)})}e.s(["any",()=>w,"array",()=>_,"assert",()=>g,"boolean",()=>x,"coerce",()=>C,"create",()=>y,"instance",()=>k,"literal",()=>S,"nullable",()=>E,"number",()=>A,"optional",()=>B,"record",()=>I,"string",()=>M,"tuple",()=>T,"type",()=>O,"union",()=>R,"unknown",()=>P],85098)},37342,e=>{"use strict";e.s([],48636),e.i(48636);var t,r,n,i=new Uint8Array(16);function s(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(i)}let o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,a=function(e){return"string"==typeof e&&o.test(e)};for(var u=[],l=0;l<256;++l)u.push((l+256).toString(16).substr(1));let c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase();
1if(!a(r))throw TypeError("Stringified UUID is invalid");return r};var f=0,h=0;let d=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/0x10000000000&255,r[11]=t/0x100000000&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};function p(e,t,r){function n(e,n,i,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=d(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),(o=r(o))[6]=15&o[6]|t,o[8]=63&o[8]|128,i){s=s||0;for(var a=0;a<16;++a)i[s+a]=o[a];return i}return c(o)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function m(e){return(e+64>>>9<<4)+14+1}function g(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function y(e,t,r,n,i,s){var o;return g((o=g(g(t,e),g(n,s)))<<i|o>>>32-i,r)}function b(e,t,r,n,i,s,o){return y(t&r|~t&n,e,t,i,s,o)}function v(e,t,r,n,i,s,o){return y(t&n|r&~n,e,t,i,s,o)}function w(e,t,r,n,i,s,o){return y(t^r^n,e,t,i,s,o)}function _(e,t,r,n,i,s,o){return y(r^(t|~n),e,t,i,s,o)}var x=p("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var s=e[i>>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[m(t)-1]=t;for(var r=0x67452301,n=-0x10325477,i=-0x67452302,s=0x10325476,o=0;o<e.length;o+=16){var a=r,u=n,l=i,c=s;r=b(r,n,i,s,e[o],7,-0x28955b88),s=b(s,r,n,i,e[o+1],12,-0x173848aa),i=b(i,s,r,n,e[o+2],17,0x242070db),n=b(n,i,s,r,e[o+3],22,-0x3e423112),r=b(r,n,i,s,e[o+4],7,-0xa83f051),s=b(s,r,n,i,e[o+5],12,0x4787c62a),i=b(i,s,r,n,e[o+6],17,-0x57cfb9ed),n=b(n,i,s,r,e[o+7],22,-0x2b96aff),r=b(r,n,i,s,e[o+8],7,0x698098d8),s=b(s,r,n,i,e[o+9],12,-0x74bb0851),i=b(i,s,r,n,e[o+10],17,-42063),n=b(n,i,s,r,e[o+11],22,-0x76a32842),r=b(r,n,i,s,e[o+12],7,0x6b901122),s=b(s,r,n,i,e[o+13],12,-0x2678e6d),i=b(i,s,r,n,e[o+14],17,-0x5986bc72),n=b(n,i,s,r,e[o+15],22,0x49b40821),r=v(r,n,i,s,e[o+1],5,-0x9e1da9e),s=v(s,r,n,i,e[o+6],9,-0x3fbf4cc0),i=v(i,s,r,n,e[o+11],14,0x265e5a51),n=v(n,i,s,r,e[o],20,-0x16493856),r=v(r,n,i,s,e[o+5],5,-0x29d0efa3),s=v(s,r,n,i,e[o+10],9,0x2441453),i=v(i,s,r,n,e[o+15],14,-0x275e197f),n=v(n,i,s,r,e[o+4],20,-0x182c0438),r=v(r,n,i,s,e[o+9],5,0x21e1cde6),s=v(s,r,n,i,e[o+14],9,-0x3cc8f82a),i=v(i,s,r,n,e[o+3],14,-0xb2af279),n=v(n,i,s,r,e[o+8],20,0x455a14ed),r=v(r,n,i,s,e[o+13],5,-0x561c16fb),s=v(s,r,n,i,e[o+2],9,-0x3105c08),i=v(i,s,r,n,e[o+7],14,0x676f02d9),n=v(n,i,s,r,e[o+12],20,-0x72d5b376),r=w(r,n,i,s,e[o+5],4,-378558),s=w(s,r,n,i,e[o+8],11,-0x788e097f),i=w(i,s,r,n,e[o+11],16,0x6d9d6122),n=w(n,i,s,r,e[o+14],23,-0x21ac7f4),r=w(r,n,i,s,e[o+1],4,-0x5b4115bc),s=w(s,r,n,i,e[o+4],11,0x4bdecfa9),i=w(i,s,r,n,e[o+7],16,-0x944b4a0),n=w(n,i,s,r,e[o+10],23,-0x41404390),r=w(r,n,i,s,e[o+13],4,0x289b7ec6),s=w(s,r,n,i,e[o],11,-0x155ed806),i=w(i,s,r,n,e[o+3],16,-0x2b10cf7b),n=w(n,i,s,r,e[o+6],23,0x4881d05),r=w(r,n,i,s,e[o+9],4,-0x262b2fc7),s=w(s,r,n,i,e[o+12],11,-0x1924661b),i=w(i,s,r,n,e[o+15],16,0x1fa27cf8),n=w(n,i,s,r,e[o+2],23,-0x3b53a99b),r=_(r,n,i,s,e[o],6,-0xbd6ddbc),s=_(s,r,n,i,e[o+7],10,0x432aff97),i=_(i,s,r,n,e[o+14],15,-0x546bdc59),n=_(n,i,s,r,e[o+5],21,-0x36c5fc7),r=_(r,n,i,s,e[o+12],6,0x655b59c3),s=_(s,r,n,i,e[o+3],10,-0x70f3336e),i=_(i,s,r,n,e[o+10],15,-1051523),n=_(n,i,s,r,e[o+1],21,-0x7a7ba22f),r=_(r,n,i,s,e[o+8],6,0x6fa87e4f),s=_(s,r,n,i,e[o+15],10,-0x1d31920),i=_(i,s,r,n,e[o+6],15,-0x5cfebcec),n=_(n,i,s,r,e[o+13],21,0x4e0811a1),r=_(r,n,i,s,e[o+4],6,-0x8ac817e),s=_(s,r,n,i,e[o+11],10,-0x42c50dcb),i=_(i,s,r,n,e[o+2],15,0x2ad7d2bb),n=_(n,i,s,r,e[o+9],21,-0x14792c6f),r=g(r,a),n=g(n,u),i=g(i,l),s=g(s,c)}return[r,n,i,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(m(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))});function k(e,t){return e<<t|e>>>32-t}var S=p("v5",80,function(e){var t=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6],r=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i<n.length;++i)e.push(n.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=Math.ceil((e.length/4+2)/16),o=Array(s),a=0;a<s;++a){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*a+4*l]<<24|e[64*a+4*l+1]<<16|e[64*a+4*l+2]<<8|e[64*a+4*l+3];o[a]=u}o[s-1][14]=(e.length-1)*8/0x100000000,o[s-1][14]=Math.floor(o[s-1][14]),o[s-1][15]=(e.length-1)*8|0;for(var c=0;c<s;++c){for(var f=new Uint32Array(80),h=0;h<16;++h)f[h]=o[c][h];for(var d=16;d<80;++d)f[d]=k(f[d-3]^f[d-8]^f[d-14]^f[d-16],1);for(var p=r[0],m=r[1],g=r[2],y=r[3],b=r[4],v=0;v<80;++v){var w=Math.floor(v/20),_=k(p,5)+function(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}(w,m,g,y)+b+t[w]+f[v]>>>0;b=y,y=g,g=k(m,30)>>>0,m=p,p=_}r[0]=r[0]+p>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]});e.s(["NIL",0,"00000000-0000-0000-0000-000000000000","parse",0,d,"stringify",0,c,"v1",0,function(e,t,i){var o=t&&i||0,a=t||Array(16),u=(e=e||{}).node||r,l=void 0!==e.clockseq?e.clockseq:n;if(null==u||null==l){var d=e.random||(e.rng||s)();null==u&&(u=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=n=(d[6]<<8|d[7])&16383)}var p=void 0!==e.msecs?e.msecs:Date.now(),m=void 0!==e.nsecs?e.nsecs:h+1,g=p-f+(m-h)/1e4;if(g<0&&void 0===e.clockseq&&(l=l+1&16383),(g<0||p>f)&&void 0===e.nsecs&&(m=0),m>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");f=p,h=m,n=l;var y=((0xfffffff&(p+=122192928e5))*1e4+m)%0x100000000;a[o++]=y>>>24&255,a[o++]=y>>>16&255,a[o++]=y>>>8&255,a[o++]=255&y;var b=p/0x100000000*1e4&0xfffffff;a[o++]=b>>>8&255,a[o++]=255&b,a[o++]=b>>>24&15|16,a[o++]=b>>>16&255,a[o++]=l>>>8|128,a[o++]=255&l;for(var v=0;v<6;++v)a[o+v]=u[v];return t||c(a)},"v3",0,x,"v4",0,function(e,t,r){var n=(e=e||{}).random||(e.rng||s)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return c(n)},"v5",0,S,"validate",0,a,"version",0,function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}],37342)},43173,(e,t,r)=>{"use strict";let n=e.r(37342).v4;t.exports=function(e,t,r,i){if("string"!=typeof e)throw TypeError(e+" must be a string");let s="number"==typeof(i=i||{}).version?i.version:2;if(1!==s&&2!==s)throw TypeError(s+" must be 1 or 2");let o={method:e};if(2===s&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw TypeError(t+" must be an object, array or omitted");o.params=t}return void 0===r?o.id=("function"==typeof i.generator?i.generator:function(){return n()})(o,i):2===s&&null===r?i.notificationIdNull&&(o.id=null):o.id=r,o}},78217,(e,t,r)=>{"use strict";let n=e.r(37342).v4,i=e.r(43173),s=function(e,t){if(!(this instanceof s))return new s(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return n()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};t.exports=s,s.prototype.request=function(e,t,r,n){let s,o=this,a=null,u=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&u)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!u&&e&&"object"==typeof e&&"function"==typeof t;if(u||l)n=t,a=e;else{"function"==typeof r&&(n=r,r=void 0);let s="function"==typeof n;try{a=i(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(s)return n(e);throw e}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(e){return n(e)}return this.callServer(s,function(e,t){o._parseResponse(e,t,n)}),a},s.prototype._parseResponse=function(e,t,r){let n;if(e)return void r(e);if(!t)return r();try{n=JSON.parse(t,this.options.reviver)}catch(e){return r(e)}if(3===r.length)if(!Array.isArray(n))return r(null,n.error,n.result);else{let e=function(e){return void 0!==e.error};return r(null,n.filter(e),n.filter(function(t){return!e(t)}))}r(null,n)}},6011,75522,91158,60519,68542,60576,92209,36602,38631,e=>{"use strict";let t,r,n,i;e.i(50482),e.i(36480),e.i(14889),e.i(82563),e.i(11220),e.i(79821);var s,o,a,u,l,c,f=e.i(43943),h=e.i(14303),d=e.i(16853),p=e.i(54611),m=e.i(80355),g=e.i(54119),y=e.i(44610),b=e.i(38340),v=e.i(85098),w=e.i(78217),_=e.i(95932),x=e.i(87246),k=class extends x.EventEmitter{socket;constructor(e,t){super(),this.socket=new window.WebSocket(e,t.protocols),this.socket.onopen=()=>
vendor: 4,284 bytes, line 1
1this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,r){let n=r||t;try{this.socket.send(e),n()}catch(e){n(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}},S=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},E=class extends x.EventEmitter{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...o}={},a,u){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=a||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),u?this.dataPack=u:this.dataPack=new S,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,n){return n||"object"!=typeof r||(n=r,r=null),new Promise((i,s)=>{if(!this.ready)return s(Error("socket not ready"));let o=this.generate_request_id(e,t);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t||void 0,id:o}),n,e=>{if(e)return s(e);this.queue[o]={promise:[i,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(e){let t=await this.call("rpc.login",e);if(!t)throw Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,n)=>{if(!this.ready)return n(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t}),e=>{if(e)return n(e);r()})})}async subscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket&&this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=f.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);let t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,t)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>
vendor: 17,053 bytes, line 1
1this.emit("error",e)),this.socket.addEventListener("close",({code:r,reason:n})=>{this.ready&&setTimeout(()=>this.emit("close",r,n),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(e,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,n),1))})}},A=e.i(45535),B=e.i(44314),I=e.i(70525),M=e.i(40965),T=e.i(26539),O=e.i(10588),R=e.i(70948);let P=(e,t)=>(e+(e>=0?t:-t)/z)/t;function C(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function U(e,t){let r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return(0,T._abool2)(r.lowS,"lowS"),(0,T._abool2)(r.prehash,"prehash"),void 0!==r.format&&C(r.format),r}let L={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(e,t)=>{let{Err:r}=L;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=(0,T.numberToHexUnpadded)(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?(0,T.numberToHexUnpadded)(i.length/2|128):"";return(0,T.numberToHexUnpadded)(e)+s+i+t},decode(e,t){let{Err:r}=L,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],s=0;if(128&i){let e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;let o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=L;if(e<N)throw new t("integer: negative integers are not allowed");let r=(0,T.numberToHexUnpadded)(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=L;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return(0,T.bytesToNumberBE)(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=L,i=(0,T.ensureBytes)("signature",e),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,s),{v:l,l:c}=n.decode(2,u);if(c.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=L,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s));return t.encode(48,n+i)}},N=BigInt(0),j=BigInt(1),z=BigInt(2),q=BigInt(3),Z=BigInt(4);function F(e,t){let r,{BYTES:n}=e;if("bigint"==typeof t)r=t;else{let i=(0,T.ensureBytes)("private key",t);try{r=e.fromBytes(i)}catch(e){throw Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw Error("invalid private key: out of range [1..N-1]");return r}function D(e){return Uint8Array.of(e?2:3)}function W(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}var $=e.i(33795);let K={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},V={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},H=BigInt(0),G=BigInt(2),J=(0,R.Field)(K.p,{sqrt:function(e){let t=K.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=e*e*e%t,c=l*l*e%t,f=(0,R.pow2)(c,r,t)*c%t,h=(0,R.pow2)(f,r,t)*c%t,d=(0,R.pow2)(h,G,t)*l%t,p=(0,R.pow2)(d,i,t)*d%t,m=(0,R.pow2)(p,s,t)*p%t,g=(0,R.pow2)(m,a,t)*m%t,y=(0,R.pow2)(g,u,t)*g%t,b=(0,R.pow2)(y,a,t)*m%t,v=(0,R.pow2)(b,r,t)*c%t,w=(0,R.pow2)(v,o,t)*p%t,_=(0,R.pow2)(w,n,t)*l%t,x=(0,R.pow2)(_,G,t);if(!J.eql(J.sqr(x),e))throw Error("Cannot find square root");return x}}),Y=(s={...K,Fp:J,lowS:!0,endo:V},o=B.sha256,{...(r=e=>(function(e){let t,{CURVE:r,curveOpts:n,hash:i,ecdsaOpts:s}=function(e){let t,r,n,i,{CURVE:s,curveOpts:o}=(t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r=e.Fp,n=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0,i={Fp:r,Fn:(0,R.Field)(t.n,{BITS:e.nBitLength,allowedLengths:n,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes},{CURVE:t,curveOpts:i}),a={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:s,curveOpts:o,hash:e.hash,ecdsaOpts:a}}(e),o=function(e,t,r={}){(0,I.ahash)(t),(0,T._validateObject)(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||I.randomBytes,i=r.hmac||((e,...r)=>(0,M.hmac)(t,e,(0,I.concatBytes)(...r))),{Fp:s,Fn:o}=e,{ORDER:a,BITS:u}=o,{keygen:l,getPublicKey:c,getSharedSecret:f,utils:h,lengths:d}=function(e,t={}){let{Fn:r}=e,n=t.randomBytes||I.randomBytes,i=Object.assign(W(e.Fp,r),{seed:(0,R.getMinHashLength)(r.ORDER)});function s(e){try{return!!F(r,e)}catch(e){return!1}}function o(e=n(i.seed)){return(0,R.mapHashToField)((0,T._abytes2)(e,i.seed,"seed"),r.ORDER)}function a(t,n=!0){return e.BASE.multiply(F(r,t)).toBytes(n)}function u(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;let{secretKey:n,publicKey:s,publicKeyUncompressed:o}=i;if(r.allowedLengths||n===s)return;let a=(0,T.ensureBytes)("key",t).length;return a===s||a===o}return Object.freeze({getPublicKey:a,getSharedSecret:function(t,n,i=!0){if(!0===u(t))throw Error("first arg must be private key");if(!1===u(n))throw Error("second arg must be public key");let s=F(r,t);return e.fromHex(n).multiply(s).toBytes(i)},keygen:function(e){let t=o(e);return{secretKey:t,publicKey:a(t)}},Point:e,utils:{isValidSecretKey:s,isValidPublicKey:function(t,r){let{publicKey:n,publicKeyUncompressed:s}=i;try{let i=t.length;if(!0===r&&i!==n||!1===r&&i!==s)return!1;return!!e.fromBytes(t)}catch(e){return!1}},randomSecretKey:o,isValidPrivateKey:s,randomPrivateKey:o,normPrivateKeyToScalar:e=>F(r,e),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)},lengths:i})}(e,r),p={prehash:!1,lowS:"boolean"==typeof r.lowS&&r.lowS,format:void 0,extraEntropy:!1},m="compact";function g(e,t){if(!o.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class y{constructor(e,t,r){this.r=g("r",e),this.s=g("s",t),null!=r&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,t=m){var r,n;let i,s;if(r=e,C(n=t),s=d.signature,(0,T._abytes2)(r,"compact"===n?s:"recovered"===n?s+1:void 0,`${n} signature`),"der"===t){let{r:t,s:r}=L.toSig((0,T._abytes2)(e));return new y(t,r)}"recovered"===t&&(i=e[0],t="compact",e=e.subarray(1));let a=o.BYTES,u=e.subarray(0,a),l=e.subarray(a,2*a);return new y(o.fromBytes(u),o.fromBytes(l),i)}static fromHex(e,t){return this.fromBytes((0,I.hexToBytes)(e),t)}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(t){let r=s.ORDER,{r:n,s:i,recovery:u}=this;if(null==u||![0,1,2,3].includes(u))throw Error("recovery id invalid");if(a*z<r&&u>1)throw Error("recovery id is ambiguous for h>1 curve");let l=2===u||3===u?n+a:n;if(!s.isValid(l))throw Error("recovery id 2 or 3 invalid");let c=s.toBytes(l),f=e.fromBytes((0,I.concatBytes)(D((1&u)==0),c)),h=o.inv(l),d=v((0,T.ensureBytes)("msgHash",t)),p=o.create(-d*h),m=o.create(i*h),g=e.BASE.multiplyUnsafe(p).add(f.multiplyUnsafe(m));if(g.is0())throw Error("point at infinify");return g.assertValidity(),g}hasHighS(){return this.s>a>>j}toBytes(e=m){if(C(e),"der"===e)return(0,I.hexToBytes)(L.hexFromSig(this));let t=o.toBytes(this.r),r=o.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw Error("recovery bit must be present");return(0,I.concatBytes)(Uint8Array.of(this.recovery),t,r)}return(0,I.concatBytes)(t,r)}toHex(e){return(0,I.bytesToHex)(this.toBytes(e))}assertValidity(){}static fromCompact(e){return y.fromBytes((0,T.ensureBytes)("sig",e),"compact")}static fromDER(e){return y.fromBytes((0,T.ensureBytes)("sig",e),"der")}normalizeS(){return this.hasHighS()?new y(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,I.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,I.bytesToHex)(this.toBytes("compact"))}}let b=r.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=(0,T.bytesToNumberBE)(e),r=8*e.length-u;return r>0?t>>BigInt(r):t},v=r.bits2int_modN||function(e){return o.create(b(e))},w=(0,T.bitMask)(u);function _(e){return(0,T.aInRange)("num < 2^"+u,e,N,w),o.toBytes(e)}function x(e,r){return(0,T._abytes2)(e,void 0,"message"),r?(0,T._abytes2)(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:l,getPublicKey:c,getSharedSecret:f,utils:h,lengths:d,Point:e,sign:function(r,s,u={}){let{seed:l,k2sig:c}=function(t,r,i){if(["recovered","canonical"].some(e=>e in i))throw Error("sign() legacy options not supported");let{lowS:s,prehash:u,extraEntropy:l}=U(i,p),c=v(t=x(t,u)),f=F(o,r),h=[_(f),_(c)];if(null!=l&&!1!==l){let e=!0===l?n(d.secretKey):l;h.push((0,T.ensureBytes)("extraEntropy",e))}return{seed:(0,I.concatBytes)(...h),k2sig:function(t){let r=b(t);if(!o.isValidNot0(r))return;let n=o.inv(r),i=e.BASE.multiply(r).toAffine(),u=o.create(i.x);if(u===N)return;let l=o.create(n*o.create(c+u*f));if(l===N)return;let h=2*(i.x!==u)|Number(i.y&j),d=l;return s&&l>a>>j&&(d=o.neg(l),h^=1),new y(u,d,h)}}}(r=(0,T.ensureBytes)("message",r),s,u);return(0,T.createHmacDrbg)(t.outputLen,o.BYTES,i)(l,c)},verify:function(t,r,n,i={}){let{lowS:s,prehash:a,format:u}=U(i,p);if(n=(0,T.ensureBytes)("publicKey",n),r=x((0,T.ensureBytes)("message",r),a),"strict"in i)throw Error("options.strict was renamed to lowS");let l=void 0===u?function(e){let t,r="string"==typeof e||(0,I.isBytes)(e),n=!r&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!r&&!n)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(n)t=new y(e.r,e.s);else if(r){try{t=y.fromBytes((0,T.ensureBytes)("sig",e),"der")}catch(e){if(!(e instanceof L.Err))throw e}if(!t)try{t=y.fromBytes((0,T.ensureBytes)("sig",e),"compact")}catch(e){return!1}}return!!t&&t}(t):y.fromBytes((0,T.ensureBytes)("sig",t),u);if(!1===l)return!1;try{let t=e.fromBytes(n);if(s&&l.hasHighS())return!1;let{r:i,s:a}=l,u=v(r),c=o.inv(a),f=o.create(u*c),h=o.create(i*c),d=e.BASE.multiplyUnsafe(f).add(t.multiplyUnsafe(h));if(d.is0())return!1;return o.create(d.x)===i}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){let{prehash:n}=U(r,p);return t=x(t,n),y.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:y,hash:t})}(function(e,t={}){let r=(0,O._createCurveFields)("weierstrass",e,t),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o,n:a}=s;(0,T._validateObject)(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:u}=t;if(u&&(!n.is0(s.a)||"bigint"!=typeof u.beta||!Array.isArray(u.basises)))throw Error('invalid endo: expected "beta": bigint and "basises": array');let l=W(n,i);function c(){if(!n.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}let f=t.toBytes||function(e,t,r){let{x:i,y:s}=t.toAffine(),o=n.toBytes(i);if((0,T._abool2)(r,"isCompressed"),!r)return(0,I.concatBytes)(Uint8Array.of(4),o,n.toBytes(s));{c();let e=!n.isOdd(s);return(0,I.concatBytes)(D(e),o)}},h=t.fromBytes||function(e){(0,T._abytes2)(e,void 0,"Point");let{publicKey:t,publicKeyUncompressed:r}=l,i=e.length,s=e[0],o=e.subarray(1);if(i===t&&(2===s||3===s)){let e,t=n.fromBytes(o);if(!n.isValid(t))throw Error("bad point: is not on curve, wrong x");let r=d(t);try{e=n.sqrt(r)}catch(e){throw Error("bad point: is not on curve, sqrt error"+(e instanceof Error?": "+e.message:""))}return c(),(1&s)==1!==n.isOdd(e)&&(e=n.neg(e)),{x:t,y:e}}if(i===r&&4===s){let e=n.BYTES,t=n.fromBytes(o.subarray(0,e)),r=n.fromBytes(o.subarray(e,2*e));if(!p(t,r))throw Error("bad point: is not on curve");return{x:t,y:r}}throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)};function d(e){let t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,s.a)),s.b)}function p(e,t){let r=n.sqr(t),i=d(e);return n.eql(r,i)}if(!p(s.Gx,s.Gy))throw Error("bad curve params: generator point");let m=n.mul(n.pow(s.a,q),Z),g=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(m,g)))throw Error("bad curve params: a or b");function y(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw Error(`bad point coordinate ${e}`);return t}function b(e){if(!(e instanceof k))throw Error("ProjectivePoint expected")}function v(e){if(!u||!u.basises)throw Error("no endo");return function(e,t,r){let[[n,i],[s,o]]=t,a=P(o*e,r),u=P(-i*e,r),l=e-a*n-u*s,c=-a*i-u*o,f=l<N,h=c<N;f&&(l=-l),h&&(c=-c);let d=(0,T.bitMask)(Math.ceil((0,T.bitLen)(r)/2))+j;if(l<N||l>=d||c<N||c>=d)throw Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:l,k2neg:h,k2:c}}(e,u.basises,i.ORDER)}let w=(0,T.memoized)((e,t)=>{let{X:r,Y:i,Z:s}=e;if(n.eql(s,n.ONE))return{x:r,y:i};let o=e.is0();null==t&&(t=o?n.ONE:n.inv(s));let a=n.mul(r,t),u=n.mul(i,t),l=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw Error("invZ was invalid");return{x:a,y:u}}),_=(0,T.memoized)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw Error("bad point: ZERO")}let{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw Error("bad point: x or y not field elements");if(!p(r,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function x(e,t,r,i,s){return r=new k(n.mul(r.X,e),r.Y,r.Z),t=(0,O.negateCt)(i,t),r=(0,O.negateCt)(s,r),t.add(r)}class k{constructor(e,t,r){this.X=y("x",e),this.Y=y("y",t,!0),this.Z=y("z",r),Object.freeze(this)}static CURVE(){return s}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error("invalid affine point");if(e instanceof k)throw Error("projective point not allowed");return n.is0(t)&&n.is0(r)?k.ZERO:new k(t,r,n.ONE)}static fromBytes(e){let t=k.fromAffine(h((0,T._abytes2)(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return k.fromBytes((0,T.ensureBytes)("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return E.createCache(this,e),t||this.multiply(q),this}assertValidity(){_(this)}hasEvenY(){let{y:e}=this.toAffine();if(!n.isOdd)throw Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){b(e);let{X:t,Y:r,Z:i}=this,{X:s,Y:o,Z:a}=e,u=n.eql(n.mul(t,a),n.mul(s,i)),l=n.eql(n.mul(r,a),n.mul(o,i));return u&&l}negate(){return new k(this.X,n.neg(this.Y),this.Z)}double(){let{a:e,b:t}=s,r=n.mul(t,q),{X:i,Y:o,Z:a}=this,u=n.ZERO,l=n.ZERO,c=n.ZERO,f=n.mul(i,i),h=n.mul(o,o),d=n.mul(a,a),p=n.mul(i,o);return p=n.add(p,p),c=n.mul(i,a),c=n.add(c,c),u=n.mul(e,c),l=n.mul(r,d),l=n.add(u,l),u=n.sub(h,l),l=n.add(h,l),l=n.mul(u,l),u=n.mul(p,u),c=n.mul(r,c),d=n.mul(e,d),p=n.sub(f,d),p=n.mul(e,p),p=n.add(p,c),c=n.add(f,f),f=n.add(c,f),f=n.add(f,d),f=n.mul(f,p),l=n.add(l,f),d=n.mul(o,a),d=n.add(d,d),f=n.mul(d,p),u=n.sub(u,f),c=n.mul(d,h),c=n.add(c,c),new k(u,l,c=n.add(c,c))}add(e){b(e);let{X:t,Y:r,Z:i}=this,{X:o,Y:a,Z:u}=e,l=n.ZERO,c=n.ZERO,f=n.ZERO,h=s.a,d=n.mul(s.b,q),p=n.mul(t,o),m=n.mul(r,a),g=n.mul(i,u),y=n.add(t,r),v=n.add(o,a);y=n.mul(y,v),v=n.add(p,m),y=n.sub(y,v),v=n.add(t,i);let w=n.add(o,u);return v=n.mul(v,w),w=n.add(p,g),v=n.sub(v,w),w=n.add(r,i),l=n.add(a,u),w=n.mul(w,l),l=n.add(m,g),w=n.sub(w,l),f=n.mul(h,v),l=n.mul(d,g),f=n.add(l,f),l=n.sub(m,f),f=n.add(m,f),c=n.mul(l,f),m=n.add(p,p),m=n.add(m,p),g=n.mul(h,g),v=n.mul(d,v),m=n.add(m,g),g=n.sub(p,g),g=n.mul(h,g),v=n.add(v,g),p=n.mul(m,v),c=n.add(c,p),p=n.mul(w,v),l=n.mul(y,l),l=n.sub(l,p),p=n.mul(y,m),f=n.mul(w,f),new k(l,c,f=n.add(f,p))}subtract(e){return this.add(e.negate())}is0(){return this.equals(k.ZERO)}multiply(e){let r,n,{endo:s}=t;if(!i.isValidNot0(e))throw Error("invalid scalar: out of range");let o=e=>E.cached(this,e,e=>(0,O.normalizeZ)(k,e));
1if(s){let{k1neg:t,k1:i,k2neg:a,k2:u}=v(e),{p:l,f:c}=o(i),{p:f,f:h}=o(u);n=c.add(h),r=x(s.beta,l,f,t,a)}else{let{p:t,f:i}=o(e);r=t,n=i}return(0,O.normalizeZ)(k,[r,n])[0]}multiplyUnsafe(e){let{endo:r}=t;if(!i.isValid(e))throw Error("invalid scalar: out of range");if(e===N||this.is0())return k.ZERO;if(e===j)return this;if(E.hasCache(this))return this.multiply(e);if(!r)return E.unsafe(this,e);{let{k1neg:t,k1:n,k2neg:i,k2:s}=v(e),{p1:o,p2:a}=(0,O.mulEndoUnsafe)(k,this,n,s);return x(r.beta,o,a,t,i)}}multiplyAndAddUnsafe(e,t,r){let n=this.multiplyUnsafe(t).add(e.multiplyUnsafe(r));return n.is0()?void 0:n}toAffine(e){return w(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return o===j||(e?e(k,this):E.unsafe(this,a).is0())}clearCofactor(){let{clearCofactor:e}=t;return o===j?this:e?e(k,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(e=!0){return(0,T._abool2)(e,"isCompressed"),this.assertValidity(),f(k,this,e)}toHex(e=!0){return(0,I.bytesToHex)(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return(0,O.normalizeZ)(k,e)}static msm(e,t){return(0,O.pippenger)(k,i,e,t)}static fromPrivateKey(e){return k.BASE.multiply(F(i,e))}}k.BASE=new k(s.Gx,s.Gy,n.ONE),k.ZERO=new k(n.ZERO,n.ONE,n.ZERO),k.Fp=n,k.Fn=i;let S=i.BITS,E=new O.wNAF(k,t.endo?Math.ceil(S/2):S);return k.BASE.precompute(8),k}(r,n),i,s);return t=o.Point,Object.assign({},o,{ProjectivePoint:t,CURVE:Object.assign({},e,(0,R.nLength)(t.Fn.ORDER,t.Fn.BITS))})})({...s,hash:e}))(o),create:r});Y.Point;T.bytesToNumberBE;let X=(0,$.isogenyMap)(J,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(e=>BigInt(e)))),Q=function(e,t){(0,R.validateField)(e);let{A:r,B:n,Z:i}=t;if(!e.isValid(r)||!e.isValid(n)||!e.isValid(i))throw Error("mapToCurveSimpleSWU: invalid opts");let s=function(e,t){let r=e.ORDER,n=N;for(let e=r-j;e%z===N;e/=z)n+=j;let i=n,s=z<<i-j-j,o=s*z,a=(r-j)/o,u=(a-j)/z,l=o-j,c=e.pow(t,a),f=e.pow(t,(a+j)/z),h=(t,r)=>{let n=c,o=e.pow(r,l),a=e.sqr(o);a=e.mul(a,r);let h=e.mul(t,a);h=e.pow(h,u),h=e.mul(h,o),o=e.mul(h,r),a=e.mul(h,t);let d=e.mul(a,o);h=e.pow(d,s);let p=e.eql(h,e.ONE);o=e.mul(a,f),h=e.mul(d,n),a=e.cmov(o,a,p),d=e.cmov(h,d,p);for(let t=i;t>j;t--){let r=t-z;r=z<<r-j;let i=e.pow(d,r),s=e.eql(i,e.ONE);o=e.mul(a,n),n=e.mul(n,n),i=e.mul(d,n),a=e.cmov(o,a,s),d=e.cmov(i,d,s)}return{isValid:p,value:a}};if(e.ORDER%Z===q){let r=(e.ORDER-q)/Z,n=e.sqrt(e.neg(t));h=(t,i)=>{let s=e.sqr(i),o=e.mul(t,i);s=e.mul(s,o);let a=e.pow(s,r);a=e.mul(a,o);let u=e.mul(a,n),l=e.mul(e.sqr(a),i),c=e.eql(l,t),f=e.cmov(u,a,c);return{isValid:c,value:f}}}return h}(e,i);if(!e.isOdd)throw Error("Field does not have .isOdd()");return t=>{let o,a,u,l,c,f,h,d;o=e.sqr(t),o=e.mul(o,i),a=e.sqr(o),a=e.add(a,o),u=e.add(a,e.ONE),u=e.mul(u,n),l=e.cmov(i,e.neg(a),!e.eql(a,e.ZERO)),l=e.mul(l,r),a=e.sqr(u),f=e.sqr(l),c=e.mul(f,r),a=e.add(a,c),a=e.mul(a,u),f=e.mul(f,l),c=e.mul(f,n),a=e.add(a,c),h=e.mul(o,u);let{isValid:p,value:m}=s(a,f);d=e.mul(o,t),d=e.mul(d,m),h=e.cmov(h,u,p),d=e.cmov(d,m,p);let g=e.isOdd(t)===e.isOdd(d);d=e.cmov(e.neg(d),d,g);let y=(0,R.FpInvertBatch)(e,[l],!0)[0];return{x:h=e.mul(h,y),y:d}}}
1(J,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:J.create(BigInt("-11"))});(0,$.createHasher)(Y.Point,e=>{let{x:t,y:r}=Q(J.create(e[0]));return X(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:J.ORDER,m:1,k:128,expand:"xmd",hash:B.sha256}),h.ed25519.utils.randomPrivateKey;let ee=()=>{let e=h.ed25519.utils.randomPrivateKey(),t=et(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),{publicKey:t,secretKey:r}},et=h.ed25519.getPublicKey;function er(e){try{return h.ed25519.ExtendedPoint.fromHex(e),!0}catch{return!1}}let en=(e,t)=>h.ed25519.sign(e,t.slice(0,32)),ei=h.ed25519.verify,es=e=>f.Buffer.isBuffer(e)?e:e instanceof Uint8Array?f.Buffer.from(e.buffer,e.byteOffset,e.byteLength):f.Buffer.from(e);class eo{constructor(e){Object.assign(this,e)}encode(){return f.Buffer.from((0,g.serialize)(ea,this))}static decode(e){return(0,g.deserialize)(ea,this,e)}static decodeUnchecked(e){return(0,g.deserializeUnchecked)(ea,this,e)}}let ea=new Map,eu=1;class el extends eo{constructor(e){if(super({}),this._bn=void 0,void 0!==e._bn)this._bn=e._bn;else{if("string"==typeof e){const t=p.default.decode(e);if(32!=t.length)throw Error("Invalid public key input");this._bn=new d.default(t)}else this._bn=new d.default(e);if(this._bn.byteLength()>32)throw Error("Invalid public key input")}}static unique(){let e=new el(eu);return eu+=1,new el(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return p.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){let e=this._bn.toArrayLike(f.Buffer);if(32===e.length)return e;let t=f.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,r){let n=f.Buffer.concat([e.toBuffer(),f.Buffer.from(t),r.toBuffer()]);return new el((0,m.sha256)(n))}static createProgramAddressSync(e,t){let r=f.Buffer.alloc(0);e.forEach(function(e){if(e.length>32)throw TypeError("Max seed length exceeded");r=f.Buffer.concat([r,es(e)])}),r=f.Buffer.concat([r,t.toBuffer(),f.Buffer.from("ProgramDerivedAddress")]);let n=(0,m.sha256)(r);if(er(n))throw Error("Invalid seeds, address must fall off the curve");return new el(n)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let r,n=255;for(;0!=n;){try{let i=e.concat(f.Buffer.from([n]));r=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;n--;continue}return[r,n]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return er(new el(e).toBytes())}}el.default=new el("11111111111111111111111111111111"),ea.set(el,{kind:"struct",fields:[["_bn","u256"]]}),new el("BPFLoader1111111111111111111111111111111111");class ec extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(ec.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class ef extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(ef.prototype,"name",{value:"TransactionExpiredTimeoutError"});class eh extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(eh.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class ed{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){let e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(let t of this.keySegments())if(e<t.length)return t[e];else e-=t.length}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw Error("Account index overflow encountered during compilation");let t=new Map;
vendor: 37,807 bytes, lines 1-7
1this.keySegments().flat().forEach((e,r)=>{t.set(e.toBase58(),r)});let r=e=>{let r=t.get(e.toBase58());if(void 0===r)throw Error("Encountered an unknown instruction account key during compilation");return r};return e.map(e=>({programIdIndex:r(e.programId),accountKeyIndexes:e.keys.map(e=>r(e.pubkey)),data:e.data}))}}let ep=(e="publicKey")=>y.blob(32,e),em=(e="string")=>{let t=y.struct([y.u32("length"),y.u32("lengthPadding"),y.blob(y.offset(y.u32(),-8),"chars")],e),r=t.decode.bind(t),n=t.encode.bind(t);return t.decode=(e,t)=>r(e,t).chars.toString(),t.encode=(e,t,r)=>n({chars:f.Buffer.from(e,"utf8")},t,r),t.alloc=e=>y.u32().span+y.u32().span+f.Buffer.from(e,"utf8").length,t};function eg(e){let t=0,r=0;for(;;){let n=e.shift();if(t|=(127&n)<<7*r,r+=1,(128&n)==0)break}return t}function ey(e,t){let r=t;for(;;){let t=127&r;if(0==(r>>=7)){e.push(t);break}t|=128,e.push(t)}}function eb(e,t){if(!e)throw Error(t||"Assertion failed")}class ev{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){let r=new Map,n=e=>{let t=e.toBase58(),n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},i=n(t);for(let t of(i.isSigner=!0,i.isWritable=!0,e))for(let e of(n(t.programId).isInvoked=!0,t.keys)){let t=n(e.pubkey);t.isSigner||=e.isSigner,t.isWritable||=e.isWritable}return new ev(t,r)}getMessageComponents(){let e=[...this.keyMetaMap.entries()];eb(e.length<=256,"Max static account keys length exceeded");let t=e.filter(([,e])=>e.isSigner&&e.isWritable),r=e.filter(([,e])=>e.isSigner&&!e.isWritable),n=e.filter(([,e])=>!e.isSigner&&e.isWritable),i=e.filter(([,e])=>!e.isSigner&&!e.isWritable),s={numRequiredSignatures:t.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{eb(t.length>0,"Expected at least one writable signer key");let[e]=t[0];eb(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...t.map(([e])=>new el(e)),...r.map(([e])=>new el(e)),...n.map(([e])=>new el(e)),...i.map(([e])=>new el(e))]]}extractTableLookup(e){let[t,r]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&e.isWritable),[n,i]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&!e.isWritable);if(0!==t.length||0!==n.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(e,t){let r=[],n=[];for(let[i,s]of this.keyMetaMap.entries())if(t(s)){let t=new el(i),s=e.findIndex(e=>e.equals(t));s>=0&&(eb(s<256,"Max lookup table index exceeded"),r.push(s),n.push(t),this.keyMetaMap.delete(i))}return[r,n]}}let ew="Reached end of buffer unexpectedly";function e_(e){if(0===e.length)throw Error(ew);return e.shift()}function ex(e,...t){let[r]=t;if(2===t.length?r+(t[1]??0)>e.length:r>=e.length)throw Error(ew);return e.splice(...t)}class ek{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(e=>new el(e)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:p.default.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new ed(this.staticAccountKeys)}static compile(e){let[t,r]=ev.compile(e.instructions,e.payerKey).getMessageComponents(),n=new ed(r).compileInstructions(e.instructions).map(e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:p.default.encode(e.data)}));return new ek({header:t,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:n})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let t=this.header.numRequiredSignatures;if(!(e>=this.header.numRequiredSignatures))return e<t-this.header.numReadonlySignedAccounts;{let r=this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts;return e-t<r}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){let e=this.accountKeys.length,t=[];ey(t,e);let r=this.instructions.map(e=>{let{accounts:t,programIdIndex:r}=e,n=Array.from(p.default.decode(e.data)),i=[];ey(i,t.length);let s=[];return ey(s,n.length),{programIdIndex:r,keyIndicesCount:f.Buffer.from(i),keyIndices:t,dataLength:f.Buffer.from(s),data:n}}),n=[];ey(n,r.length);let i=f.Buffer.alloc(1232);f.Buffer.from(n).copy(i);let s=n.length;r.forEach(e=>{let t=y.struct([y.u8("programIdIndex"),y.blob(e.keyIndicesCount.length,"keyIndicesCount"),y.seq(y.u8("keyIndex"),e.keyIndices.length,"keyIndices"),y.blob(e.dataLength.length,"dataLength"),y.seq(y.u8("userdatum"),e.data.length,"data")]).encode(e,i,s);s+=t}),i=i.slice(0,s);let o=y.struct([y.blob(1,"numRequiredSignatures"),y.blob(1,"numReadonlySignedAccounts"),y.blob(1,"numReadonlyUnsignedAccounts"),y.blob(t.length,"keyCount"),y.seq(ep("key"),e,"keys"),ep("recentBlockhash")]),a={numRequiredSignatures:f.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:f.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:f.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:f.Buffer.from(t),keys:this.accountKeys.map(e=>es(e.toBytes())),recentBlockhash:p.default.decode(this.recentBlockhash)},u=f.Buffer.alloc(2048),l=o.encode(a,u);return i.copy(u,l),u.slice(0,l+i.length)}static from(e){let t=[...e],r=e_(t);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let n=e_(t),i=e_(t),s=eg(t),o=[];for(let e=0;e<s;e++){let e=ex(t,0,32);o.push(new el(f.Buffer.from(e)))}let a=ex(t,0,32),u=eg(t),l=[];for(let e=0;e<u;e++){let e=e_(t),r=eg(t),n=ex(t,0,r),i=eg(t),s=ex(t,0,i),o=p.default.encode(f.Buffer.from(s));l.push({programIdIndex:e,accounts:n,data:o})}return new ek({header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:i},recentBlockhash:p.default.encode(f.Buffer.from(a)),accountKeys:o,instructions:l})}}class eS{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(let t of this.addressTableLookups)e+=t.readonlyIndexes.length+t.writableIndexes.length;return e}getAccountKeys(e){let t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw Error("Failed to get account keys because address table lookups were not resolved");return new ed(this.staticAccountKeys,t)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){let t=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(e>=r)return e-r<this.addressTableLookups.reduce((e,t)=>e+t.writableIndexes.length,0);if(!(e>=this.header.numRequiredSignatures))return e<t-this.header.numReadonlySignedAccounts;{let n=r-t-this.header.numReadonlyUnsignedAccounts;return e-t<n}}resolveAddressTableLookups(e){let t={writable:[],readonly:[]};for(let r of this.addressTableLookups){let n=e.find(e=>e.key.equals(r.accountKey));if(!n)throw Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(let e of r.writableIndexes)if(e<n.state.addresses.length)t.writable.push(n.state.addresses[e]);else throw Error(`Failed to find address for index ${e} in address lookup table ${r.accountKey.toBase58()}`);for(let e of r.readonlyIndexes)if(e<n.state.addresses.length)t.readonly.push(n.state.addresses[e]);else throw Error(`Failed to find address for index ${e} in address lookup table ${r.accountKey.toBase58()}`)}return t}static compile(e){let t=ev.compile(e.instructions,e.payerKey),r=[],n={writable:[],readonly:[]};for(let i of e.addressLookupTableAccounts||[]){let e=t.extractTableLookup(i);if(void 0!==e){let[t,{writable:i,readonly:s}]=e;r.push(t),n.writable.push(...i),n.readonly.push(...s)}}let[i,s]=t.getMessageComponents(),o=new ed(s,n).compileInstructions(e.instructions);return new eS({header:i,staticAccountKeys:s,recentBlockhash:e.recentBlockhash,compiledInstructions:o,addressTableLookups:r})}serialize(){let e=[];ey(e,this.staticAccountKeys.length);let t=this.serializeInstructions(),r=[];ey(r,this.compiledInstructions.length);let n=this.serializeAddressTableLookups(),i=[];ey(i,this.addressTableLookups.length);let s=y.struct([y.u8("prefix"),y.struct([y.u8("numRequiredSignatures"),y.u8("numReadonlySignedAccounts"),y.u8("numReadonlyUnsignedAccounts")],"header"),y.blob(e.length,"staticAccountKeysLength"),y.seq(ep(),this.staticAccountKeys.length,"staticAccountKeys"),ep("recentBlockhash"),y.blob(r.length,"instructionsLength"),y.blob(t.length,"serializedInstructions"),y.blob(i.length,"addressTableLookupsLength"),y.blob(n.length,"serializedAddressTableLookups")]),o=new Uint8Array(1232),a=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(e=>e.toBytes()),recentBlockhash:p.default.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:n},o);return o.slice(0,a)}serializeInstructions(){let e=0,t=new Uint8Array(1232);for(let r of this.compiledInstructions){let n=[];ey(n,r.accountKeyIndexes.length);let i=[];ey(i,r.data.length);let s=y.struct([y.u8("programIdIndex"),y.blob(n.length,"encodedAccountKeyIndexesLength"),y.seq(y.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),y.blob(i.length,"encodedDataLength"),y.blob(r.data.length,"data")]);e+=s.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(n),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:r.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0,t=new Uint8Array(1232);for(let r of this.addressTableLookups){let n=[];ey(n,r.writableIndexes.length);let i=[];ey(i,r.readonlyIndexes.length);let s=y.struct([ep("accountKey"),y.blob(n.length,"encodedWritableIndexesLength"),y.seq(y.u8(),r.writableIndexes.length,"writableIndexes"),y.blob(i.length,"encodedReadonlyIndexesLength"),y.seq(y.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);e+=s.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(n),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e],r=e_(t),n=127&r;eb(r!==n,"Expected versioned message but received legacy message"),eb(0===n,`Expected versioned message with version 0 but found version ${n}`);let i={numRequiredSignatures:e_(t),numReadonlySignedAccounts:e_(t),numReadonlyUnsignedAccounts:e_(t)},s=[],o=eg(t);for(let e=0;e<o;e++)s.push(new el(ex(t,0,32)));let a=p.default.encode(ex(t,0,32)),u=eg(t),l=[];for(let e=0;e<u;e++){let e=e_(t),r=eg(t),n=ex(t,0,r),i=eg(t),s=new Uint8Array(ex(t,0,i));l.push({programIdIndex:e,accountKeyIndexes:n,data:s})}let c=eg(t),f=[];for(let e=0;e<c;e++){let e=new el(ex(t,0,32)),r=eg(t),n=ex(t,0,r),i=eg(t),s=ex(t,0,i);f.push({accountKey:e,writableIndexes:n,readonlyIndexes:s})}return new eS({header:i,staticAccountKeys:s,recentBlockhash:a,compiledInstructions:l,addressTableLookups:f})}}let eE={deserializeMessageVersion(e){let t=e[0],r=127&t;return r===t?"legacy":r},deserialize:e=>{let t=eE.deserializeMessageVersion(e);if("legacy"===t)return ek.from(e);if(0===t)return eS.deserialize(e);throw Error(`Transaction message version ${t} deserialization is not supported`)}},eA=((a={})[a.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",a[a.PROCESSED=1]="PROCESSED",a[a.TIMED_OUT=2]="TIMED_OUT",a[a.NONCE_INVALID=3]="NONCE_INVALID",a),eB=f.Buffer.alloc(64).fill(0);class eI{constructor(e){this.keys=void 0,this.programId=void 0,this.data=f.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:r})=>({pubkey:e.toJSON(),isSigner:t,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class eM{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!e)return;if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:r}=e;this.minNonceContextSlot=t,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:r}=e;this.recentBlockhash=t,this.lastValidBlockHeight=r}else{const{recentBlockhash:t,nonceInfo:r}=e;r&&(this.nonceInfo=r),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(0===e.length)throw Error("No instructions");return e.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new eI(e))}),this}compileMessage(){let e,t,r;if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let e=0;e<t.length;e++)if(void 0===t[e].programId)throw Error(`Transaction instruction index ${e} has undefined program id`);let n=[],i=[];t.forEach(e=>{e.keys.forEach(e=>{i.push({...e})});let t=e.programId.toString();n.includes(t)||n.push(t)}),n.forEach(e=>{i.push({pubkey:new el(e),isSigner:!1,isWritable:!1})});let s=[];i.forEach(e=>{let t=e.pubkey.toString(),r=s.findIndex(e=>e.pubkey.toString()===t);r>-1?(s[r].isWritable=s[r].isWritable||e.isWritable,s[r].isSigner=s[r].isSigner||e.isSigner):s.push(e)}),s.sort(function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});let o=s.findIndex(e=>e.pubkey.equals(r));if(o>-1){let[e]=s.splice(o,1);e.isSigner=!0,e.isWritable=!0,s.unshift(e)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let e of this.signatures){let t=s.findIndex(t=>t.pubkey.equals(e.publicKey));if(t>-1)s[t].isSigner||(s[t].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw Error(`unknown signer: ${e.publicKey.toString()}`)}let a=0,u=0,l=0,c=[],f=[];s.forEach(({pubkey:e,isSigner:t,isWritable:r})=>{t?(c.push(e.toString()),a+=1,r||(u+=1)):(f.push(e.toString()),r||(l+=1))});let h=c.concat(f),d=t.map(e=>{let{data:t,programId:r}=e;return{programIdIndex:h.indexOf(r.toString()),accounts:e.keys.map(e=>h.indexOf(e.pubkey.toString())),data:p.default.encode(t)}});return d.forEach(e=>{eb(e.programIdIndex>=0),e.accounts.forEach(e=>eb(e>=0))}),new ek({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:h,recentBlockhash:e,instructions:d})}_compile(){let e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((e,r)=>t[r].equals(e.publicKey))?e:(this.signatures=t.map(e=>({signature:null,publicKey:e})),e)}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(0===e.length)throw Error("No signers");let t=new Set;this.signatures=e.filter(e=>{let r=e.toString();return!t.has(r)&&(t.add(r),!0)}).map(e=>({signature:null,publicKey:e}))}sign(...e){if(0===e.length)throw Error("No signers");let t=new Set,r=[];for(let n of e){let e=n.publicKey.toString();t.has(e)||(t.add(e),r.push(n))}this.signatures=r.map(e=>({signature:null,publicKey:e.publicKey}));let n=this._compile();this._partialSign(n,...r)}partialSign(...e){if(0===e.length)throw Error("No signers");let t=new Set,r=[];for(let n of e){let e=n.publicKey.toString();t.has(e)||(t.add(e),r.push(n))}let n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){let r=e.serialize();t.forEach(e=>{let t=en(r,e.secretKey);this._addSignature(e.publicKey,es(t))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){eb(64===t.length);let r=this.signatures.findIndex(t=>e.equals(t.publicKey));if(r<0)throw Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=f.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){let r={};for(let{signature:n,publicKey:i}of this.signatures)null===n?t&&(r.missing||=[]).push(i):ei(n,e,i.toBytes())||(r.invalid||=[]).push(i);return r.invalid||r.missing?r:void 0}serialize(e){let{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r){let e=this._getMessageSignednessErrors(n,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=` 2Invalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map(e=>e.toBase58()).join("`, `")}\`].`),e.missing&&(t+=` 3Missing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map(e=>e.toBase58()).join("`, `")}\`].`),Error(t)}}return this._serialize(n)}_serialize(e){let{signatures:t}=this,r=[];ey(r,t.length);let n=r.length+64*t.length+e.length,i=f.Buffer.alloc(n);return eb(t.length<256),f.Buffer.from(r).copy(i,0),t.forEach(({signature:e},t)=>{null!==e&&(eb(64===e.length,"signature has invalid length"),f.Buffer.from(e).copy(i,r.length+64*t))}),e.copy(i,r.length+64*t.length),eb(i.length<=1232,`Transaction too large: ${i.length} > 1232`),i}get keys(){return eb(1===this.instructions.length),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return eb(1===this.instructions.length),this.instructions[0].programId}get data(){return eb(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e],r=eg(t),n=[];for(let e=0;e<r;e++){let e=ex(t,0,64);n.push(p.default.encode(f.Buffer.from(e)))}return eM.populate(ek.from(t),n)}static populate(e,t=[]){let r=new eM;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((t,n)=>{let i={signature:t==p.default.encode(eB)?null:p.default.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)}),e.instructions.forEach(t=>{let n=t.accounts.map(t=>{let n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some(e=>e.publicKey.toString()===n.toString())||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}});r.instructions.push(new eI({keys:n,programId:e.accountKeys[t.programIdIndex],data:p.default.decode(t.data)}))}),r._message=e,r._json=r.toJSON(),r}}class eT{get version(){return this.message.version}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)eb(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{const t=[];for(let r=0;r<e.header.numRequiredSignatures;r++)t.push(new Uint8Array(64));this.signatures=t}this.message=e}serialize(){let e=this.message.serialize(),t=[];ey(t,this.signatures.length);let r=y.struct([y.blob(t.length,"encodedSignaturesLength"),y.seq(((e="signature")=>y.blob(64,e))(),this.signatures.length,"signatures"),y.blob(e.length,"serializedMessage")]),n=new Uint8Array(2048),i=r.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},n);return n.slice(0,i)}static deserialize(e){let t=[...e],r=[],n=eg(t);for(let e=0;e<n;e++)r.push(new Uint8Array(ex(t,0,64)));return new eT(eE.deserialize(new Uint8Array(t)),r)}sign(e){let t=this.message.serialize(),r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let n of e){let e=r.findIndex(e=>e.equals(n.publicKey));eb(e>=0,`Cannot sign with non signer key ${n.publicKey.toBase58()}`),this.signatures[e]=en(t,n.secretKey)}}addSignature(e,t){eb(64===t.byteLength,"Signature must be 64 bytes long");let r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(t=>t.equals(e));eb(r>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[r]=t}}let eO=new el("SysvarC1ock11111111111111111111111111111111");new el("SysvarEpochSchedu1e111111111111111111111111"),new el("Sysvar1nstructions1111111111111111111111111");let eR=new el("SysvarRecentB1ockHashes11111111111111111111"),eP=new el("SysvarRent111111111111111111111111111111111");new el("SysvarRewards111111111111111111111111111111"),new el("SysvarS1otHashes111111111111111111111111111"),new el("SysvarS1otHistory11111111111111111111111111");let eC=new el("SysvarStakeHistory1111111111111111111111111");class eU extends Error{constructor({action:e,signature:t,transactionMessage:r,logs:n}){let i;const s=n?`Logs: 4${JSON.stringify(n.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";switch(e){case"send":i=`Transaction ${t} resulted in an error. 5${r}. `+s+o;break;case"simulate":i=`Simulation failed. 6Message: ${r}. 7`+s+o;break;default:i=`Unknown action '${e}'`}super(i),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,this.transactionMessage=r,this.transactionLogs=n||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((t,r)=>{e.getTransaction(this.signature).then(e=>{if(e&&e.meta&&e.meta.logMessages){let r=e.meta.logMessages;this.transactionLogs=r,t(r)}else r(Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}class eL extends Error{constructor({code:e,message:t,data:r},n){super(null!=n?`${n}: ${t}`:t),this.code=void 0,this.data=void 0,this.code=e,this.data=r,this.name="SolanaJSONRPCError"}}async function eN(e,t,r,n){let i,s=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},o=await e.sendTransaction(t,r,s);if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)i=(await e.confirmTransaction({abortSignal:n?.abortSignal,signature:o,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){let{nonceInstruction:r}=t.nonceInfo,s=r.keys[0].pubkey;i=(await e.confirmTransaction({abortSignal:n?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:s,nonceValue:t.nonceInfo.nonce,signature:o},n&&n.commitment)).value}else n?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),i=(await e.confirmTransaction(o,n&&n.commitment)).value;if(i.err){if(null!=o)throw new eU({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(i)})`});throw Error(`Transaction ${o} failed (${JSON.stringify(i)})`)}return o}function ej(e){return new Promise(t=>setTimeout(t,e))}function ez(e,t){let r=e.layout.span>=0?e.layout.span:function e(t,r){let n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(r[t.property]);if("count"in t&&"elementLayout"in t){let e=r[t.property];if(Array.isArray(e))return e.length*n(t.elementLayout)}else if("fields"in t)return e({layout:t},r[t.property]);return 0},i=0;return t.layout.fields.forEach(e=>{i+=n(e)}),i}(e,t),n=f.Buffer.alloc(r),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,n),n}let eq=y.nu64("lamportsPerSignature"),eZ=y.struct([y.u32("version"),y.u32("state"),ep("authorizedPubkey"),ep("nonce"),y.struct([eq],"feeCalculator")]),eF=eZ.span;class eD{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){let t=eZ.decode(es(e),0);return new eD({authorizedPubkey:new el(t.authorizedPubkey),nonce:new el(t.nonce).toString(),feeCalculator:t.feeCalculator})}}function eW(e){let t=(0,y.blob)(8,e),r=t.decode.bind(t),n=t.encode.bind(t),i=(0,b.getU64Codec)();return t.decode=(e,t)=>{let n=r(e,t);return i.decode(n)},t.encode=(e,t,r)=>n(i.encode(e),t,r),t}let e$=Object.freeze({Create:{index:0,layout:y.struct([y.u32("instruction"),y.ns64("lamports"),y.ns64("space"),ep("programId")])},Assign:{index:1,layout:y.struct([y.u32("instruction"),ep("programId")])},Transfer:{index:2,layout:y.struct([y.u32("instruction"),eW("lamports")])},CreateWithSeed:{index:3,layout:y.struct([y.u32("instruction"),ep("base"),em("seed"),y.ns64("lamports"),y.ns64("space"),ep("programId")])},AdvanceNonceAccount:{index:4,layout:y.struct([y.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:y.struct([y.u32("instruction"),y.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:y.struct([y.u32("instruction"),ep("authorized")])},AuthorizeNonceAccount:{index:7,layout:y.struct([y.u32("instruction"),ep("authorized")])},Allocate:{index:8,layout:y.struct([y.u32("instruction"),y.ns64("space")])},AllocateWithSeed:{index:9,layout:y.struct([y.u32("instruction"),ep("base"),em("seed"),y.ns64("space"),ep("programId")])},AssignWithSeed:{index:10,layout:y.struct([y.u32("instruction"),ep("base"),em("seed"),ep("programId")])},TransferWithSeed:{index:11,layout:y.struct([y.u32("instruction"),eW("lamports"),em("seed"),ep("programId")])},UpgradeNonceAccount:{index:12,layout:y.struct([y.u32("instruction")])}});class eK{constructor(){}static createAccount(e){let t=ez(e$.Create,{lamports:e.lamports,space:e.space,programId:es(e.programId.toBuffer())});return new eI({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,r;return"basePubkey"in e?(t=ez(e$.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:es(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=ez(e$.Transfer,{lamports:BigInt(e.lamports)}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]),new eI({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;return"basePubkey"in e?(t=ez(e$.AssignWithSeed,{base:es(e.basePubkey.toBuffer()),seed:e.seed,programId:es(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=ez(e$.Assign,{programId:es(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new eI({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){let t=ez(e$.CreateWithSeed,{base:es(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:es(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||r.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new eI({keys:r,programId:this.programId,data:t})}static createNonceAccount(e){let t=new eM;"basePubkey"in e&&"seed"in e?t.add(eK.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:eF,programId:this.programId})):t.add(eK.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:eF,programId:this.programId}));let r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){let t=ez(e$.InitializeNonceAccount,{authorized:es(e.authorizedPubkey.toBuffer())});return new eI({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:eR,isSigner:!1,isWritable:!1},{pubkey:eP,isSigner:!1,isWritable:!1}],programId:this.programId,data:t})}static nonceAdvance(e){let t=ez(e$.AdvanceNonceAccount);return new eI({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:eR,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceWithdraw(e){let t=ez(e$.WithdrawNonceAccount,{lamports:e.lamports});return new eI({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:eR,isSigner:!1,isWritable:!1},{pubkey:eP,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){let t=ez(e$.AuthorizeNonceAccount,{authorized:es(e.newAuthorizedPubkey.toBuffer())});return new eI({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,r;return"basePubkey"in e?(t=ez(e$.AllocateWithSeed,{base:es(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:es(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=ez(e$.Allocate,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new eI({keys:r,programId:this.programId,data:t})}}eK.programId=new el("11111111111111111111111111111111");class eV{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/eV.chunkSize)+1+1)}static async load(e,t,r,n,i){{let s=await e.getMinimumBalanceForRentExemption(i.length),o=await e.getAccountInfo(r.publicKey,"confirmed"),a=null;if(null!==o){if(o.executable)return console.error("Program load failed, account is already executable"),!1;o.data.length!==i.length&&(a=a||new eM).add(eK.allocate({accountPubkey:r.publicKey,space:i.length})),o.owner.equals(n)||(a=a||new eM).add(eK.assign({accountPubkey:r.publicKey,programId:n})),o.lamports<s&&(a=a||new eM).add(eK.transfer({fromPubkey:t.publicKey,toPubkey:r.publicKey,lamports:s-o.lamports}))}else a=new eM().add(eK.createAccount({fromPubkey:t.publicKey,newAccountPubkey:r.publicKey,lamports:s>0?s:1,space:i.length,programId:n}));null!==a&&await eN(e,a,[t,r],{commitment:"confirmed"})}let s=y.struct([y.u32("instruction"),y.u32("offset"),y.u32("bytesLength"),y.u32("bytesLengthPadding"),y.seq(y.u8("byte"),y.offset(y.u32(),-8),"bytes")]),o=eV.chunkSize,a=0,u=i,l=[];for(;u.length>0;){let i=u.slice(0,o),c=f.Buffer.alloc(o+16);s.encode({instruction:0,offset:a,bytes:i,bytesLength:0,bytesLengthPadding:0},c);let h=new eM().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:n,data:c});l.push(eN(e,h,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await ej(250),a+=o,u=u.slice(o)}await Promise.all(l);{let i=y.struct([y.u32("instruction")]),s=f.Buffer.alloc(i.span);i.encode({instruction:1},s);let o=new eM().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:eP,isSigner:!1,isWritable:!1}],programId:n,data:s}),a="processed",u=await e.sendTransaction(o,[t,r],{preflightCommitment:a}),{context:l,value:c}=await e.confirmTransaction({signature:u,lastValidBlockHeight:o.lastValidBlockHeight,blockhash:o.recentBlockhash},a);if(c.err)throw Error(`Transaction ${u} failed (${JSON.stringify(c)})`);for(;;){try{if(await e.getSlot({commitment:a})>l.slot)break}catch{}await new Promise(e=>setTimeout(e,Math.round(200)))}}return!0}}eV.chunkSize=932,new el("BPFLoader2111111111111111111111111111111111");var eH=(u=function(){if(c)return l;c=1;var e=Object.prototype.toString,t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};return l=function(r){var n=function r(n,i){var s,o,a,u,l,c,f;if(!0===n)return"true";if(!1===n)return"false";switch(typeof n){case"object":if(null===n)return null;if(n.toJSON&&"function"==typeof n.toJSON)return r(n.toJSON(),i);if("[object Array]"===(f=e.call(n))){for(s=0,a="[",o=n.length-1;s<o;s++)a+=r(n[s],!0)+",";return o>-1&&(a+=r(n[s],!0)),a+"]"}if("[object Object]"!==f)return JSON.stringify(n);for(o=(u=t(n).sort()).length,a="",s=0;s<o;)void 0!==(c=r(n[l=u[s]],!1))&&(a&&(a+=","),a+=JSON.stringify(l)+":"+c),s++;return"{"+a+"}";case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(n);default:return isFinite(n)?n:null}}(r,!1);if(void 0!==n)return""+n}}())&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u;function eG(e){let t=0;for(;e>1;)e/=2,t++;return t}class eJ{constructor(e,t,r,n,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=r,this.firstNormalEpoch=n,this.firstNormalSlot=i}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){var t;let r=eG(0===(t=e+32+1)?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,(t|=t>>32)+1))-eG(32)-1,n=this.getSlotsInEpoch(r);return[r,e-(n-32)]}{let t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+r,t%this.slotsPerEpoch]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*32:(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+eG(32)):this.slotsPerEpoch}}var eY=globalThis.fetch;class eX extends E{constructor(e,t,r){super(e=>{let r=new k(e,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return"socket"in r?this.underlyingSocket=r.socket:this.underlyingSocket=r,r},e,t,r),this.underlyingSocket=void 0}call(...e){let t=this.underlyingSocket?.readyState;return 1===t?super.call(...e):Promise.reject(Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(...e){let t=this.underlyingSocket?.readyState;return 1===t?super.notify(...e):Promise.reject(Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class eQ{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){let e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){let t=function(e,t){let r;try{r=e.layout.decode(t)}catch(e){throw Error("invalid instruction; "+e)}if(r.typeIndex!==e.index)throw Error(`invalid account data; account type mismatch ${r.typeIndex} != ${e.index}`);return r}(e0,e),r=e.length-56;eb(r>=0,"lookup table is invalid"),eb(r%32==0,"lookup table is invalid");let{addresses:n}=y.struct([y.seq(ep(),r/32,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new el(t.authority[0]):void 0,addresses:n.map(e=>new el(e))}}}let e0={index:1,layout:y.struct([y.u32("typeIndex"),eW("deactivationSlot"),y.nu64("lastExtendedSlot"),y.u8("lastExtendedStartIndex"),y.u8(),y.seq(ep(),y.offset(y.u8(),-1),"authority")])},e1=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,e2=(0,v.coerce)((0,v.instance)(el),(0,v.string)(),e=>new el(e)),e6=(0,v.tuple)([(0,v.string)(),(0,v.literal)("base64")]),e3=(0,v.coerce)((0,v.instance)(f.Buffer),e6,e=>f.Buffer.from(e[0],"base64"));function e5(e){let t,r;if("string"==typeof e)t=e;
7else if(e){let{commitment:n,...i}=e;t=n,r=i}return{commitment:t,config:r}}function e8(e){return e.map(e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e)}function e4(e){return(0,v.union)([(0,v.type)({jsonrpc:(0,v.literal)("2.0"),id:(0,v.string)(),result:e}),(0,v.type)({jsonrpc:(0,v.literal)("2.0"),id:(0,v.string)(),error:(0,v.type)({code:(0,v.unknown)(),message:(0,v.string)(),data:(0,v.optional)((0,v.any)())})})])}let e9=e4((0,v.unknown)());function e7(e){return(0,v.coerce)(e4(e),e9,t=>"error"in t?t:{...t,result:(0,v.create)(t.result,e)})}function te(e){return e7((0,v.type)({context:(0,v.type)({slot:(0,v.number)()}),value:e}))}function tt(e){return(0,v.type)({context:(0,v.type)({slot:(0,v.number)()}),value:e})}function tr(e,t){return 0===e?new eS({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new el(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:p.default.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new ek(t)}let tn=(0,v.type)({foundation:(0,v.number)(),foundationTerm:(0,v.number)(),initial:(0,v.number)(),taper:(0,v.number)(),terminal:(0,v.number)()}),ti=e7((0,v.array)((0,v.nullable)((0,v.type)({epoch:(0,v.number)(),effectiveSlot:(0,v.number)(),amount:(0,v.number)(),postBalance:(0,v.number)(),commission:(0,v.optional)((0,v.nullable)((0,v.number)()))})))),ts=(0,v.array)((0,v.type)({slot:(0,v.number)(),prioritizationFee:(0,v.number)()})),to=(0,v.type)({total:(0,v.number)(),validator:(0,v.number)(),foundation:(0,v.number)(),epoch:(0,v.number)()}),ta=(0,v.type)({epoch:(0,v.number)(),slotIndex:(0,v.number)(),slotsInEpoch:(0,v.number)(),absoluteSlot:(0,v.number)(),blockHeight:(0,v.optional)((0,v.number)()),transactionCount:(0,v.optional)((0,v.number)())}),tu=(0,v.type)({slotsPerEpoch:(0,v.number)(),leaderScheduleSlotOffset:(0,v.number)(),warmup:(0,v.boolean)(),firstNormalEpoch:(0,v.number)(),firstNormalSlot:(0,v.number)()}),tl=(0,v.record)((0,v.string)(),(0,v.array)((0,v.number)())),tc=(0,v.nullable)((0,v.union)([(0,v.type)({}),(0,v.string)()])),tf=(0,v.type)({err:tc}),th=(0,v.literal)("receivedSignature"),td=(0,v.type)({"solana-core":(0,v.string)(),"feature-set":(0,v.optional)((0,v.number)())}),tp=(0,v.type)({program:(0,v.string)(),programId:e2,parsed:(0,v.unknown)()}),tm=(0,v.type)({programId:e2,accounts:(0,v.array)(e2),data:(0,v.string)()}),tg=te((0,v.type)({err:(0,v.nullable)((0,v.union)([(0,v.type)({}),(0,v.string)()])),logs:(0,v.nullable)((0,v.array)((0,v.string)())),accounts:(0,v.optional)((0,v.nullable)((0,v.array)((0,v.nullable)((0,v.type)({executable:(0,v.boolean)(),owner:(0,v.string)(),lamports:(0,v.number)(),data:(0,v.array)((0,v.string)()),rentEpoch:(0,v.optional)((0,v.number)())}))))),unitsConsumed:(0,v.optional)((0,v.number)()),returnData:(0,v.optional)((0,v.nullable)((0,v.type)({programId:(0,v.string)(),data:(0,v.tuple)([(0,v.string)(),(0,v.literal)("base64")])}))),innerInstructions:(0,v.optional)((0,v.nullable)((0,v.array)((0,v.type)({index:(0,v.number)(),instructions:(0,v.array)((0,v.union)([tp,tm]))}))))})),ty=te((0,v.type)({byIdentity:(0,v.record)((0,v.string)(),(0,v.array)((0,v.number)())),range:(0,v.type)({firstSlot:(0,v.number)(),lastSlot:(0,v.number)()})})),tb=e7(tn),tv=e7(to),tw=e7(ts),t_=e7(ta),tx=e7(tu),tk=e7(tl),tS=e7((0,v.number)()),tE=te((0,v.type)({total:(0,v.number)(),circulating:(0,v.number)(),nonCirculating:(0,v.number)(),nonCirculatingAccounts:(0,v.array)(e2)})),tA=(0,v.type)({amount:(0,v.string)(),uiAmount:(0,v.nullable)((0,v.number)()),decimals:(0,v.number)(),uiAmountString:(0,v.optional)((0,v.string)())}),tB=te((0,v.array)((0,v.type)({address:e2,amount:(0,v.string)(),uiAmount:(0,v.nullable)((0,v.number)()),decimals:(0,v.number)(),uiAmountString:(0,v.optional)((0,v.string)())}))),tI=te((0,v.array)((0,v.type)({pubkey:e2,account:(0,v.type)({executable:(0,v.boolean)(),owner:e2,lamports:(0,v.number)(),data:e3,rentEpoch:(0,v.number)()})}))),tM=(0,v.type)({program:(0,v.string)(),parsed:(0,v.unknown)(),space:(0,v.number)()}),tT=te((0,v.array)((0,v.type)({pubkey:e2,account:(0,v.type)({executable:(0,v.boolean)(),owner:e2,lamports:(0,v.number)(),data:tM,rentEpoch:(0,v.number)()})}))),tO=te((0,v.array)((0,v.type)({lamports:(0,v.number)(),address:e2}))),tR=(0,v.type)({executable:(0,v.boolean)(),owner:e2,lamports:(0,v.number)(),data:e3,rentEpoch:(0,v.number)()}),tP=(0,v.type)({pubkey:e2,account:tR}),tC=(0,v.coerce)((0,v.union)([(0,v.instance)(f.Buffer),tM]),(0,v.union)([e6,tM]),e=>Array.isArray(e)?(0,v.create)(e,e3):e),tU=(0,v.type)({executable:(0,v.boolean)(),owner:e2,lamports:(0,v.number)(),data:tC,rentEpoch:(0,v.number)()}),tL=(0,v.type)({pubkey:e2,account:tU}),tN=(0,v.type)({state:(0,v.union)([(0,v.literal)("active"),(0,v.literal)("inactive"),(0,v.literal)("activating"),(0,v.literal)("deactivating")]),active:(0,v.number)(),inactive:(0,v.number)()}),tj=e7((0,v.array)((0,v.type)({signature:(0,v.string)(),slot:(0,v.number)(),err:tc,memo:(0,v.nullable)((0,v.string)()),blockTime:(0,v.optional)((0,v.nullable)((0,v.number)()))}))),tz=e7((0,v.array)((0,v.type)({signature:(0,v.string)(),slot:(0,v.number)(),err:tc,memo:(0,v.nullable)((0,v.string)()),blockTime:(0,v.optional)((0,v.nullable)((0,v.number)()))}))),tq=(0,v.type)({subscription:(0,v.number)(),result:tt(tR)}),tZ=(0,v.type)({pubkey:e2,account:tR}),tF=(0,v.type)({subscription:(0,v.number)(),result:tt(tZ)}),tD=(0,v.type)({parent:(0,v.number)(),slot:(0,v.number)(),root:(0,v.number)()}),tW=(0,v.type)({subscription:(0,v.number)(),result:tD}),t$=(0,v.union)([(0,v.type)({type:(0,v.union)([(0,v.literal)("firstShredReceived"),(0,v.literal)("completed"),(0,v.literal)("optimisticConfirmation"),(0,v.literal)("root")
7]),slot:(0,v.number)(),timestamp:(0,v.number)()}),(0,v.type)({type:(0,v.literal)("createdBank"),parent:(0,v.number)(),slot:(0,v.number)(),timestamp:(0,v.number)()}),(0,v.type)({type:(0,v.literal)("frozen"),slot:(0,v.number)(),timestamp:(0,v.number)(),stats:(0,v.type)({numTransactionEntries:(0,v.number)(),numSuccessfulTransactions:(0,v.number)(),numFailedTransactions:(0,v.number)(),maxTransactionsPerEntry:(0,v.number)()})}),(0,v.type)({type:(0,v.literal)("dead"),slot:(0,v.number)(),timestamp:(0,v.number)(),err:(0,v.string)()})]),tK=(0,v.type)({subscription:(0,v.number)(),result:t$}),tV=(0,v.type)({subscription:(0,v.number)(),result:tt((0,v.union)([tf,th]))}),tH=(0,v.type)({subscription:(0,v.number)(),result:(0,v.number)()}),tG=(0,v.type)({pubkey:(0,v.string)(),gossip:(0,v.nullable)((0,v.string)()),tpu:(0,v.nullable)((0,v.string)()),rpc:(0,v.nullable)((0,v.string)()),version:(0,v.nullable)((0,v.string)())}),tJ=(0,v.type)({votePubkey:(0,v.string)(),nodePubkey:(0,v.string)(),activatedStake:(0,v.number)(),epochVoteAccount:(0,v.boolean)(),epochCredits:(0,v.array)((0,v.tuple)([(0,v.number)(),(0,v.number)(),(0,v.number)()])),commission:(0,v.number)(),lastVote:(0,v.number)(),rootSlot:(0,v.nullable)((0,v.number)())}),tY=e7((0,v.type)({current:(0,v.array)(tJ),delinquent:(0,v.array)(tJ)})),tX=(0,v.union)([(0,v.literal)("processed"),(0,v.literal)("confirmed"),(0,v.literal)("finalized")]),tQ=(0,v.type)({slot:(0,v.number)(),confirmations:(0,v.nullable)((0,v.number)()),err:tc,confirmationStatus:(0,v.optional)(tX)}),t0=te((0,v.array)((0,v.nullable)(tQ))),t1=e7((0,v.number)()),t2=(0,v.type)({accountKey:e2,writableIndexes:(0,v.array)((0,v.number)()),readonlyIndexes:(0,v.array)((0,v.number)())}),t6=(0,v.type)({signatures:(0,v.array)((0,v.string)()),message:(0,v.type)({accountKeys:(0,v.array)((0,v.string)()),header:(0,v.type)({numRequiredSignatures:(0,v.number)(),numReadonlySignedAccounts:(0,v.number)(),numReadonlyUnsignedAccounts:(0,v.number)()}),instructions:(0,v.array)((0,v.type)({accounts:(0,v.array)((0,v.number)()),data:(0,v.string)(),programIdIndex:(0,v.number)()})),recentBlockhash:(0,v.string)(),addressTableLookups:(0,v.optional)((0,v.array)(t2))})}),t3=(0,v.type)({pubkey:e2,signer:(0,v.boolean)(),writable:(0,v.boolean)(),source:(0,v.optional)((0,v.union)([(0,v.literal)("transaction"),(0,v.literal)("lookupTable")]))}),t5=(0,v.type)({accountKeys:(0,v.array)(t3),signatures:(0,v.array)((0,v.string)())}),t8=(0,v.type)({parsed:(0,v.unknown)(),program:(0,v.string)(),programId:e2}),t4=(0,v.type)({accounts:(0,v.array)(e2),data:(0,v.string)(),programId:e2}),t9=(0,v.union)([t4,t8]),t7=(0,v.union)([(0,v.type)({parsed:(0,v.unknown)(),program:(0,v.string)(),programId:(0,v.string)()}),(0,v.type)({accounts:(0,v.array)((0,v.string)()),data:(0,v.string)(),programId:(0,v.string)()})]),re=(0,v.coerce)(t9,t7,e=>"accounts"in e?(0,v.create)(e,t4):(0,v.create)(e,t8)),rt=(0,v.type)({signatures:(0,v.array)((0,v.string)()),message:(0,v.type)({accountKeys:(0,v.array)(t3),instructions:(0,v.array)(re),recentBlockhash:(0,v.string)(),addressTableLookups:(0,v.optional)((0,v.nullable)((0,v.array)(t2)))})}),rr=(0,v.type)({accountIndex:(0,v.number)(),mint:(0,v.string)(),owner:(0,v.optional)((0,v.string)()),programId:(0,v.optional)((0,v.string)()),uiTokenAmount:tA}),rn=(0,v.type)({writable:(0,v.array)(e2),readonly:(0,v.array)(e2)}),ri=(0,v.type)({err:tc,fee:(0,v.number)(),innerInstructions:(0,v.optional)((0,v.nullable)((0,v.array)((0,v.type)({index:(0,v.number)(),instructions:(0,v.array)((0,v.type)({accounts:(0,v.array)((0,v.number)()),data:(0,v.string)(),programIdIndex:(0,v.number)()}))})))),preBalances:(0,v.array)((0,v.number)()),postBalances:(0,v.array)((0,v.number)()),logMessages:(0,v.optional)((0,v.nullable)((0,v.array)((0,v.string)()))),preTokenBalances:(0,v.optional)((0,v.nullable)((0,v.array)(rr))),postTokenBalances:(0,v.optional)((0,v.nullable)((0,v.array)(rr))),loadedAddresses:(0,v.optional)(rn),computeUnitsConsumed:(0,v.optional)((0,v.number)()),costUnits:(0,v.optional)((0,v.number)())}),rs=(0,v.type)({err:tc,fee:(0,v.number)(),innerInstructions:(0,v.optional)((0,v.nullable)((0,v.array)((0,v.type)({index:(0,v.number)(),instructions:(0,v.array)(re)})))),preBalances:(0,v.array)((0,v.number)()),postBalances:(0,v.array)((0,v.number)()),logMessages:(0,v.optional)((0,v.nullable)((0,v.array)((0,v.string)()))),preTokenBalances:(0,v.optional)((0,v.nullable)((0,v.array)(rr))),postTokenBalances:(0,v.optional)((0,v.nullable)((0,v.array)(rr))),loadedAddresses:(0,v.optional)(rn),computeUnitsConsumed:(0,v.optional)((0,v.number)()),costUnits:(0,v.optional)((0,v.number)())}),ro=(0,v.union)([(0,v.literal)(0),(0,v.literal)("legacy")]),ra=(0,v.type)({pubkey:(0,v.string)(),lamports:(0,v.number)(),postBalance:(0,v.nullable)((0,v.number)()),rewardType:(0,v.nullable)((0,v.string)()),commission:(0,v.optional)((0,v.nullable)((0,v.number)()))}),ru=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),transactions:(0,v.array)((0,v.type)({transaction:t6,meta:(0,v.nullable)(ri),version:(0,v.optional)(ro)})),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)()),blockHeight:(0,v.nullable)((0,v.number)())}))),rl=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)()),blockHeight:(0,v.nullable)((0,v.number)())}))),rc=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),transactions:(0,v.array)((0,v.type)({transaction:t5,meta:(0,v.nullable)(ri),version:(0,v.optional)(ro)})),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)()),blockHeight:(0,v.nullable)((0,v.number)())}))),rf=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),transactions:(0,v.array)((0,v.type)({transaction:rt,meta:(0,v.nullable)(rs),version:(0,v.optional)(ro)})),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)()),blockHeight:(0,v.nullable)((0,v.number)())}))),rh=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),transactions:(0,v.array)((0,v.type)({transaction:t5,meta:(0,v.nullable)(rs),version:(0,v.optional)(ro)})),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)()),blockHeight:(0,v.nullable)((0,v.number)())}))),rd=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)()),blockHeight:(0,v.nullable)((0,v.number)())}))),rp=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),transactions:(0,v.array)((0,v.type)({transaction:t6,meta:(0,v.nullable)(ri)})),rewards:(0,v.optional)((0,v.array)(ra)),blockTime:(0,v.nullable)((0,v.number)())}))),rm=e7((0,v.nullable)((0,v.type)({blockhash:(0,v.string)(),previousBlockhash:(0,v.string)(),parentSlot:(0,v.number)(),signatures:(0,v.array)((0,v.string)()),blockTime:(0,v.nullable)((0,v.number)())}))),rg=e7((0,v.nullable)((0,v.type)({slot:(0,v.number)(),meta:(0,v.nullable)(ri),blockTime:(0,v.optional)((0,v.nullable)((0,v.number)())),transaction:t6,version:(0,v.optional)(ro)}))),ry=e7((0,v.nullable)((0,v.type)({slot:(0,v.number)(),transaction:rt,meta:(0,v.nullable)(rs),blockTime:(0,v.optional)((0,v.nullable)((0,v.number)())),version:(0,v.optional)(ro)}
7))),rb=te((0,v.type)({blockhash:(0,v.string)(),lastValidBlockHeight:(0,v.number)()})),rv=te((0,v.boolean)()),rw=(0,v.type)({slot:(0,v.number)(),numTransactions:(0,v.number)(),numSlots:(0,v.number)(),samplePeriodSecs:(0,v.number)()}),r_=e7((0,v.array)(rw)),rx=te((0,v.nullable)((0,v.type)({feeCalculator:(0,v.type)({lamportsPerSignature:(0,v.number)()})}))),rk=e7((0,v.string)()),rS=e7((0,v.string)()),rE=(0,v.type)({err:tc,logs:(0,v.array)((0,v.string)()),signature:(0,v.string)()}),rA=(0,v.type)({result:tt(rE),subscription:(0,v.number)()}),rB={"solana-client":"js/1.0.0-maintenance"};class rI{constructor(e,t){var r;let n,i,s,o,a,u;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{let e={};return async t=>{let{commitment:r,config:n}=e5(t),i=this._buildArgs([],r,void 0,n),s=eH(i);return e[s]=e[s]??(async()=>{try{let e=await this._rpcRequest("getBlockHeight",i),t=(0,v.create)(e,e7((0,v.number)()));if("error"in t)throw new eL(t.error,"failed to get block height information");return t.result}finally{delete e[s]}})(),await e[s]}})(),t&&"string"==typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,n=t.wsEndpoint,i=t.httpHeaders,s=t.fetch,o=t.fetchMiddleware,a=t.disableRetryOnRateLimit,u=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=n||function(e){let t=e.match(e1);if(null==t)throw TypeError(`Failed to validate endpoint URL \`${e}\``);let[r,n,i,s]=t,o=e.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10),u=null==a?"":`:${a+1}`;return`${o}//${n}${u}${s}`}(e),this._rpcClient=function(e,t,r,n,i,s){let o,a,u=r||eY;return null!=s&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),n&&(a=async(e,t)=>{let r=await new Promise((r,i)=>{try{n(e,t,(e,t)=>r([e,t]))}catch(e){i(e)}});return await u(...r)}),new w.default(async(r,n)=>{let s={method:"POST",body:r,agent:o,headers:Object.assign({"Content-Type":"application/json"},t||{},rB)};try{let t,r=5,o=500;for(;(t=a?await a(e,s):await u(e,s),429===t.status&&!0!==i)&&(r-=1,0!==r);){;console.error(`Server responded with ${t.status} ${t.statusText}. Retrying after ${o}ms delay...`),await ej(o),o*=2}let l=await t.text();t.ok?n(null,l):n(Error(`${t.status} ${t.statusText}: ${l}`))}catch(e){e instanceof Error&&n(e)}},{})}(e,i,s,o,a,u),this._rpcRequest=(r=this._rpcClient,(e,t)=>new Promise((n,i)=>{r.request(e,t,(e,t)=>{e?i(e):n(t)})})),this._rpcBatchRequest=function(e){return t=>new Promise((r,n)=>{0===t.length&&r([]);let i=t.map(t=>e.request(t.methodName,t.args));e.request(i,(e,t)=>{e?n(e):r(t)})})}(this._rpcClient),this._rpcWebSocket=new eX(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}
7async getBalanceAndContext(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgs([e.toBase58()],r,void 0,n),s=await this._rpcRequest("getBalance",i),o=(0,v.create)(s,te((0,v.number)()));if("error"in o)throw new eL(o.error,`failed to get balance for ${e.toBase58()}`);return o.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(e=>e.value).catch(t=>{throw Error("failed to get balance of account "+e.toBase58()+": "+t)})}async getBlockTime(e){let t=await this._rpcRequest("getBlockTime",[e]),r=(0,v.create)(t,e7((0,v.nullable)((0,v.number)())));if("error"in r)throw new eL(r.error,`failed to get block time for slot ${e}`);return r.result}async getMinimumLedgerSlot(){let e=await this._rpcRequest("minimumLedgerSlot",[]),t=(0,v.create)(e,e7((0,v.number)()));if("error"in t)throw new eL(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){let e=await this._rpcRequest("getFirstAvailableBlock",[]),t=(0,v.create)(e,tS);if("error"in t)throw new eL(t.error,"failed to get first available block");return t.result}async getSupply(e){let t={};t="string"==typeof e?{commitment:e}:e?{...e,commitment:e&&e.commitment||this.commitment}:{commitment:this.commitment};let r=await this._rpcRequest("getSupply",[t]),n=(0,v.create)(r,tE);if("error"in n)throw new eL(n.error,"failed to get supply");return n.result}async getTokenSupply(e,t){let r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenSupply",r),i=(0,v.create)(n,te(tA));if("error"in i)throw new eL(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(e,t){let r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenAccountBalance",r),i=(0,v.create)(n,te(tA));if("error"in i)throw new eL(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(e,t,r){let{commitment:n,config:i}=e5(r),s=[e.toBase58()];"mint"in t?s.push({mint:t.mint.toBase58()}):s.push({programId:t.programId.toBase58()});let o=this._buildArgs(s,n,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",o),u=(0,v.create)(a,tI);if("error"in u)throw new eL(u.error,`failed to get token accounts owned by account ${e.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});let i=this._buildArgs(n,r,"jsonParsed"),s=await this._rpcRequest("getTokenAccountsByOwner",i),o=(0,v.create)(s,tT);if("error"in o)throw new eL(o.error,`failed to get token accounts owned by account ${e.toBase58()}`);return o.result}async getLargestAccounts(e){let t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],n=await this._rpcRequest("getLargestAccounts",r),i=(0,v.create)(n,tO);if("error"in i)throw new eL(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(e,t){let r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenLargestAccounts",r),i=(0,v.create)(n,tB);if("error"in i)throw new eL(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgs([e.toBase58()],r,"base64",n),s=await this._rpcRequest("getAccountInfo",i),o=(0,v.create)(s,te((0,v.nullable)(tR)));if("error"in o)throw new eL(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getParsedAccountInfo(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgs([e.toBase58()],r,"jsonParsed",n),s=await this._rpcRequest("getAccountInfo",i),o=(0,v.create)(s,te((0,v.nullable)(tU)));if("error"in o)throw new eL(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(t){throw Error("failed to get info about account "+e.toBase58()+": "+t)}}async getMultipleParsedAccounts(e,t){let{commitment:r,config:n}=e5(t),i=e.map(e=>e.toBase58()),s=this._buildArgs([i],r,"jsonParsed",n),o=await this._rpcRequest("getMultipleAccounts",s),a=(0,v.create)(o,te((0,v.array)((0,v.nullable)(tU))));if("error"in a)throw new eL(a.error,`failed to get info for accounts ${i}`);return a.result}
7async getMultipleAccountsInfoAndContext(e,t){let{commitment:r,config:n}=e5(t),i=e.map(e=>e.toBase58()),s=this._buildArgs([i],r,"base64",n),o=await this._rpcRequest("getMultipleAccounts",s),a=(0,v.create)(o,te((0,v.array)((0,v.nullable)(tR))));if("error"in a)throw new eL(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,r){let{commitment:n,config:i}=e5(t),s=this._buildArgs([e.toBase58()],n,void 0,{...i,epoch:null!=r?r:i?.epoch}),o=await this._rpcRequest("getStakeActivation",s),a=(0,v.create)(o,e7(tN));if("error"in a)throw new eL(a.error,`failed to get Stake Activation ${e.toBase58()}`);return a.result}async getProgramAccounts(e,t){let{commitment:r,config:n}=e5(t),{encoding:i,...s}=n||{},o=this._buildArgs([e.toBase58()],r,i||"base64",{...s,...s.filters?{filters:e8(s.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",o),u=(0,v.array)(tP),l=!0===s.withContext?(0,v.create)(a,te(u)):(0,v.create)(a,e7(u));if("error"in l)throw new eL(l.error,`failed to get accounts owned by program ${e.toBase58()}`);return l.result}async getParsedProgramAccounts(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgs([e.toBase58()],r,"jsonParsed",n),s=await this._rpcRequest("getProgramAccounts",i),o=(0,v.create)(s,e7((0,v.array)(tL)));if("error"in o)throw new eL(o.error,`failed to get accounts owned by program ${e.toBase58()}`);return o.result}async confirmTransaction(e,t){let r,n;if("string"==typeof e)r=e;else{if(e.abortSignal?.aborted)return Promise.reject(e.abortSignal.reason);r=e.signature}try{n=p.default.decode(r)}catch(e){throw Error("signature must be base58 encoded: "+r)}return(eb(64===n.length,"signature has invalid length"),"string"==typeof e)?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:r}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((t,r)=>{null!=e&&(e.aborted?r(e.reason):e.addEventListener("abort",()=>{r(e.reason)}))})}getTransactionConfirmationPromise({commitment:e,signature:t}){let r,n,i=!1;return{abortConfirmation:()=>{n&&(n(),n=void 0),null!=r&&(this.removeSignatureListener(r),r=void 0)},confirmationPromise:new Promise((s,o)=>{try{r=this.onSignature(t,(e,t)=>{r=void 0,s({__type:eA.PROCESSED,response:{context:t,value:e}})},e);let a=new Promise(e=>{null==r?e():n=this._onSubscriptionStateChange(r,t=>{"subscribed"===t&&e()})});(async()=>{if(await a,i)return;
vendor: 1,822 bytes, line 7
7let r=await this.getSignatureStatus(t);if(i||null==r)return;let{context:n,value:u}=r;if(null!=u)if(u?.err)o(u.err);else{switch(e){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}i=!0,s({__type:eA.PROCESSED,response:{context:n,value:u}})}})()}catch(e){o(e)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:t,lastValidBlockHeight:r,signature:n}}){let i,s=!1,o=new Promise(t=>{let n=async()=>{try{return await this.getBlockHeight(e)}catch(e){return -1}};(async()=>{let e=await n();if(!s){for(;e<=r;)if(await ej(1e3),s||(e=await n(),s))return;t({__type:eA.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:e,signature:n}),l=this.getCancellationPromise(t);try{let e=await Promise.race([l,u,o]);if(e.__type===eA.PROCESSED)i=e.response;else throw new ec(n)}finally{s=!0,a()}return i}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:t,minContextSlot:r,nonceAccountPubkey:n,nonceValue:i,signature:s}}){let o,a=!1,u=new Promise(t=>{let s=i,o=null,u=async()=>{try{let{context:t,value:i}=await this.getNonceAndContext(n,{commitment:e,minContextSlot:r});return o=t.slot,i?.nonce}catch(e){return s}};(async()=>{if(s=await u(),!a)for(;;){if(i!==s)return void t({__type:eA.NONCE_INVALID,slotInWhichNonceDidAdvance:o});if(await ej(2e3),a||(s=await u(),a))return}})()}),{abortConfirmation:l,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:e,signature:s}),f=this.getCancellationPromise(t);try{let t=await Promise.race([f,c,u]);if(t.__type===eA.PROCESSED)o=t.response;else{let n;for(;;
7){let e=await this.getSignatureStatus(s);if(null==e)break;if(e.context.slot<(t.slotInWhichNonceDidAdvance??r)){await ej(400);continue}n=e;break}if(n?.value){let t=e||"finalized",{confirmationStatus:r}=n.value;switch(t){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new eh(s);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new eh(s);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new eh(s)}o={context:n.context,value:{err:n.value.err}}}else throw new eh(s)}}finally{a=!0,l()}return o}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:t}){let r,n,i=new Promise(t=>{let n=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":n=this._confirmTransactionInitialTimeout||3e4}r=setTimeout(()=>t({__type:eA.TIMED_OUT,timeoutMs:n}),n)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:e,signature:t});try{let e=await Promise.race([o,i]);if(e.__type===eA.PROCESSED)n=e.response;else throw new ef(t,e.timeoutMs/1e3)}finally{clearTimeout(r),s()}return n}async getClusterNodes(){let e=await this._rpcRequest("getClusterNodes",[]),t=(0,v.create)(e,e7((0,v.array)(tG)));if("error"in t)throw new eL(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(e){let t=this._buildArgs([],e),r=await this._rpcRequest("getVoteAccounts",t),n=(0,v.create)(r,tY);if("error"in n)throw new eL(n.error,"failed to get vote accounts");return n.result}async getSlot(e){let{commitment:t,config:r}=e5(e),n=this._buildArgs([],t,void 0,r),i=await this._rpcRequest("getSlot",n),s=(0,v.create)(i,e7((0,v.number)()));if("error"in s)throw new eL(s.error,"failed to get slot");return s.result}async getSlotLeader(e){let{commitment:t,config:r}=e5(e),n=this._buildArgs([],t,void 0,r),i=await this._rpcRequest("getSlotLeader",n),s=(0,v.create)(i,e7((0,v.string)()));if("error"in s)throw new eL(s.error,"failed to get slot leader");return s.result}async getSlotLeaders(e,t){let r=await this._rpcRequest("getSlotLeaders",[e,t]),n=(0,v.create)(r,e7((0,v.array)(e2)));if("error"in n)throw new eL(n.error,"failed to get slot leaders");return n.result}async getSignatureStatus(e,t){let{context:r,value:n}
7=await this.getSignatureStatuses([e],t);return eb(1===n.length),{context:r,value:n[0]}}async getSignatureStatuses(e,t){let r=[e];t&&r.push(t);let n=await this._rpcRequest("getSignatureStatuses",r),i=(0,v.create)(n,t0);if("error"in i)throw new eL(i.error,"failed to get signature status");return i.result}async getTransactionCount(e){let{commitment:t,config:r}=e5(e),n=this._buildArgs([],t,void 0,r),i=await this._rpcRequest("getTransactionCount",n),s=(0,v.create)(i,e7((0,v.number)()));if("error"in s)throw new eL(s.error,"failed to get transaction count");return s.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){let t=this._buildArgs([],e),r=await this._rpcRequest("getInflationGovernor",t),n=(0,v.create)(r,tb);if("error"in n)throw new eL(n.error,"failed to get inflation");return n.result}async getInflationReward(e,t,r){let{commitment:n,config:i}=e5(r),s=this._buildArgs([e.map(e=>e.toBase58())],n,void 0,{...i,epoch:null!=t?t:i?.epoch}),o=await this._rpcRequest("getInflationReward",s),a=(0,v.create)(o,ti);if("error"in a)throw new eL(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){let e=await this._rpcRequest("getInflationRate",[]),t=(0,v.create)(e,tv);if("error"in t)throw new eL(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(e){let{commitment:t,config:r}=e5(e),n=this._buildArgs([],t,void 0,r),i=await this._rpcRequest("getEpochInfo",n),s=(0,v.create)(i,t_);if("error"in s)throw new eL(s.error,"failed to get epoch info");return s.result}async getEpochSchedule(){let e=await this._rpcRequest("getEpochSchedule",[]),t=(0,v.create)(e,tx);if("error"in t)throw new eL(t.error,"failed to get epoch schedule");let r=t.result;return new eJ(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot)}async getLeaderSchedule(){let e=await this._rpcRequest("getLeaderSchedule",[]),t=(0,v.create)(e,tk);if("error"in t)throw new eL(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(e,t){let r=this._buildArgs([e],t),n=await this._rpcRequest("getMinimumBalanceForRentExemption",r),i=(0,v.create)(n,t1);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(e){let{context:t,value:{blockhash:r}}=await this.getLatestBlockhashAndContext(e);return{context:t,value:{blockhash:r,feeCalculator:{get lamportsPerSignature(){throw Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(e){let t=await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),r=(0,v.create)(t,r_);if("error"in r)throw new eL(r.error,"failed to get recent performance samples");return r.result}async getFeeCalculatorForBlockhash(e,t){let r=this._buildArgs([e],t),n=await this._rpcRequest("getFeeCalculatorForBlockhash",r),i=(0,v.create)(n,rx);if("error"in i)throw new eL(i.error,"failed to get fee calculator");let{context:s,value:o}=i.result;return{context:s,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(e,t){let r=es(e.serialize()).toString("base64"),n=this._buildArgs([r],t),i=await this._rpcRequest("getFeeForMessage",n),s=(0,v.create)(i,te((0,v.nullable)((0,v.number)())));if("error"in s)throw new eL(s.error,"failed to get fee for message");if(null===s.result)throw Error("invalid blockhash");return s.result}async getRecentPrioritizationFees(e){let t=e?.lockedWritableAccounts?.map(e=>e.toBase58()),r=t?.length?[t]:[],n=await this._rpcRequest("getRecentPrioritizationFees",r),i=(0,v.create)(n,tw);if("error"in i)throw new eL(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(e){throw Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(e){throw Error("failed to get recent blockhash: "+e)}}
7async getLatestBlockhashAndContext(e){let{commitment:t,config:r}=e5(e),n=this._buildArgs([],t,void 0,r),i=await this._rpcRequest("getLatestBlockhash",n),s=(0,v.create)(i,rb);if("error"in s)throw new eL(s.error,"failed to get latest blockhash");return s.result}async isBlockhashValid(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgs([e],r,void 0,n),s=await this._rpcRequest("isBlockhashValid",i),o=(0,v.create)(s,rv);if("error"in o)throw new eL(o.error,"failed to determine if the blockhash `"+e+"`is valid");return o.result}async getVersion(){let e=await this._rpcRequest("getVersion",[]),t=(0,v.create)(e,e7(td));if("error"in t)throw new eL(t.error,"failed to get version");return t.result}async getGenesisHash(){let e=await this._rpcRequest("getGenesisHash",[]),t=(0,v.create)(e,e7((0,v.string)()));if("error"in t)throw new eL(t.error,"failed to get genesis hash");return t.result}async getBlock(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgsAtLeastConfirmed([e],r,void 0,n),s=await this._rpcRequest("getBlock",i);try{switch(n?.transactionDetails){case"accounts":{let e=(0,v.create)(s,rc);if("error"in e)throw e.error;return e.result}case"none":{let e=(0,v.create)(s,rl);if("error"in e)throw e.error;return e.result}default:{let e=(0,v.create)(s,ru);if("error"in e)throw e.error;let{result:t}=e;return t?{...t,transactions:t.transactions.map(({transaction:e,meta:t,version:r})=>({meta:t,transaction:{...e,message:tr(r,e.message)},version:r}))}:null}}}catch(e){throw new eL(e,"failed to get confirmed block")}}async getParsedBlock(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",n),s=await this._rpcRequest("getBlock",i);try{switch(n?.transactionDetails){case"accounts":{let e=(0,v.create)(s,rh);if("error"in e)throw e.error;return e.result}case"none":{let e=(0,v.create)(s,rd);if("error"in e)throw e.error;return e.result}default:{let e=(0,v.create)(s,rf);if("error"in e)throw e.error;return e.result}}}catch(e){throw new eL(e,"failed to get block")}}async getBlockProduction(e){let t,r;if("string"==typeof e)r=e;
7else if(e){let{commitment:n,...i}=e;r=n,t=i}let n=this._buildArgs([],r,"base64",t),i=await this._rpcRequest("getBlockProduction",n),s=(0,v.create)(i,ty);if("error"in s)throw new eL(s.error,"failed to get block production information");return s.result}async getTransaction(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgsAtLeastConfirmed([e],r,void 0,n),s=await this._rpcRequest("getTransaction",i),o=(0,v.create)(s,rg);if("error"in o)throw new eL(o.error,"failed to get transaction");let a=o.result;return a?{...a,transaction:{...a.transaction,message:tr(a.version,a.transaction.message)}}:a}async getParsedTransaction(e,t){let{commitment:r,config:n}=e5(t),i=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",n),s=await this._rpcRequest("getTransaction",i),o=(0,v.create)(s,ry);if("error"in o)throw new eL(o.error,"failed to get transaction");return o.result}async getParsedTransactions(e,t){let{commitment:r,config:n}=e5(t),i=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",n)}));return(await this._rpcBatchRequest(i)).map(e=>{let t=(0,v.create)(e,ry);if("error"in t)throw new eL(t.error,"failed to get transactions");return t.result})}async getTransactions(e,t){let{commitment:r,config:n}=e5(t),i=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],r,void 0,n)}));return(await this._rpcBatchRequest(i)).map(e=>{let t=(0,v.create)(e,rg);if("error"in t)throw new eL(t.error,"failed to get transactions");let r=t.result;return r?{...r,transaction:{...r.transaction,message:tr(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(e,t){let r=this._buildArgsAtLeastConfirmed([e],t),n=await this._rpcRequest("getBlock",r),i=(0,v.create)(n,rp);if("error"in i)throw new eL(i.error,"failed to get confirmed block");let s=i.result;if(!s)throw Error("Confirmed block "+e+" not found");let o={...s,transactions:s.transactions.map(({transaction:e,meta:t})=>{let r=new ek(e.message);return{meta:t,transaction:{...e,message:r}}})};return{...o,transactions:o.transactions.map(({transaction:e,meta:t})=>({meta:t,transaction:eM.populate(e.message,e.signatures)}))}}async getBlocks(e,t,r){let n=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],r),i=await this._rpcRequest("getBlocks",n),s=(0,v.create)(i,e7((0,v.array)((0,v.number)())));if("error"in s)throw new eL(s.error,"failed to get blocks");return s.result}async getBlockSignatures(e,t){let r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=await this._rpcRequest("getBlock",r),i=(0,v.create)(n,rm);if("error"in i)throw new eL(i.error,"failed to get block");let s=i.result;if(!s)throw Error("Block "+e+" not found");return s}async getConfirmedBlockSignatures(e,t){let r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=await this._rpcRequest("getBlock",r),i=(0,v.create)(n,rm);if("error"in i)throw new eL(i.error,"failed to get confirmed block");let s=i.result;if(!s)throw Error("Confirmed block "+e+" not found");return s}async getConfirmedTransaction(e,t){let r=this._buildArgsAtLeastConfirmed([e],t),n=await this._rpcRequest("getTransaction",r),i=(0,v.create)(n,rg);if("error"in i)throw new eL(i.error,"failed to get transaction");let s=i.result;if(!s)return s;let o=new ek(s.transaction.message),a=s.transaction.signatures;return{...s,transaction:eM.populate(o,a)}}async getParsedConfirmedTransaction(e,t){let r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),n=await this._rpcRequest("getTransaction",r),i=(0,v.create)(n,ry);if("error"in i)throw new eL(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(e,t){let r=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(e=>{let t=(0,v.create)(e,ry);if("error"in t)throw new eL(t.error,"failed to get confirmed transactions");return t.result})}async getConfirmedSignaturesForAddress(e,t,r){let n={},i=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--t<=0)&&!(t<i);)try{let e=await this.getConfirmedBlockSignatures(t,"finalized");
vendor: 23,694 bytes, line 7
7e.signatures.length>0&&(n.until=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}let s=await this.getSlot("finalized");for(;!("before"in n)&&!(++r>s);)try{let e=await this.getConfirmedBlockSignatures(r);e.signatures.length>0&&(n.before=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}return(await this.getConfirmedSignaturesForAddress2(e,n)).map(e=>e.signature)}async getConfirmedSignaturesForAddress2(e,t,r){let n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",n),s=(0,v.create)(i,tj);if("error"in s)throw new eL(s.error,"failed to get confirmed signatures for address");return s.result}async getSignaturesForAddress(e,t,r){let n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),i=await this._rpcRequest("getSignaturesForAddress",n),s=(0,v.create)(i,tz);if("error"in s)throw new eL(s.error,"failed to get signatures for address");return s.result}async getAddressLookupTable(e,t){let{context:r,value:n}=await this.getAccountInfoAndContext(e,t),i=null;return null!==n&&(i=new eQ({key:e,state:eQ.deserialize(n.data)})),{context:r,value:i}}async getNonceAndContext(e,t){let{context:r,value:n}=await this.getAccountInfoAndContext(e,t),i=null;return null!==n&&(i=eD.fromAccountData(n.data)),{context:r,value:i}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(e=>e.value).catch(t=>{throw Error("failed to get nonce for account "+e.toBase58()+": "+t)})}async requestAirdrop(e,t){let r=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),n=(0,v.create)(r,rk);if("error"in n)throw new eL(n.error,`airdrop to ${e.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await ej(100);let e=Date.now()-this._blockhashInfo.lastFetch;if(null!==this._blockhashInfo.latestBlockhash&&!(e>=3e4))return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let e=Date.now(),t=this._blockhashInfo.latestBlockhash,r=t?t.blockhash:null;for(let e=0;e<50;e++){let e=await this.getLatestBlockhash("finalized");if(r!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await ej(200)}throw Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){let{commitment:t,config:r}=e5(e),n=this._buildArgs([],t,"base64",r),i=await this._rpcRequest("getStakeMinimumDelegation",n),s=(0,v.create)(i,te((0,v.number)()));if("error"in s)throw new eL(s.error,"failed to get stake minimum delegation");return s.result}async simulateTransaction(e,t,r){let n;if("message"in e){let n=e.serialize(),i=f.Buffer.from(n).toString("base64");if(Array.isArray(t)||void 0!==r)throw Error("Invalid arguments");let s=t||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment),t&&"object"==typeof t&&"innerInstructions"in t&&(s.innerInstructions=t.innerInstructions);let o=[i,s],a=await this._rpcRequest("simulateTransaction",o),u=(0,v.create)(a,tg);if("error"in u)throw Error("failed to simulate transaction: "+u.error.message);return u.result}if(e instanceof eM?((n=new eM).feePayer=e.feePayer,n.instructions=e.instructions,n.nonceInfo=e.nonceInfo,n.signatures=e.signatures):(n=eM.populate(e))._message=n._json=void 0,void 0!==t&&!Array.isArray(t))throw Error("Invalid arguments");if(n.nonceInfo&&t)n.sign(...t);else{let e=this._disableBlockhashCaching;for(;;){let r=await this._blockhashWithExpiryBlockHeight(e);if(n.lastValidBlockHeight=r.lastValidBlockHeight,n.recentBlockhash=r.blockhash,!t)break;if(n.sign(...t),!n.signature)throw Error("!signature");let i=n.signature.toString("base64");if(this._blockhashInfo.simulatedSignatures.includes(i)||this._blockhashInfo.transactionSignatures.includes(i))e=!0;else{this._blockhashInfo.simulatedSignatures.push(i);break}}}let i=n._compile(),s=i.serialize(),o=n._serialize(s).toString("base64"),a={encoding:"base64",commitment:this.commitment};r&&(a.accounts={encoding:"base64",addresses:(Array.isArray(r)?r:i.nonProgramIds()).map(e=>e.toBase58())}),t&&(a.sigVerify=!0),t&&"object"==typeof t&&"innerInstructions"in t&&(a.innerInstructions=t.innerInstructions);let u=[o,a],l=await this._rpcRequest("simulateTransaction",u),c=(0,v.create)(l,tg);if("error"in c){let e;if("data"in c.error&&(e=c.error.data.logs)&&Array.isArray(e)){let t="\n ",r=t+e.join(t);console.error(c.error.message,r)}throw new eU({action:"simulate",signature:"",transactionMessage:c.error.message,logs:e})}return c.result}async sendTransaction(e,t,r){if("version"in e){if(t&&Array.isArray(t))throw Error("Invalid arguments");let r=e.serialize();return await this.sendRawTransaction(r,t)}if(void 0===t||!Array.isArray(t))throw Error("Invalid arguments");if(e.nonceInfo)e.sign(...t);else{let r=this._disableBlockhashCaching;for(;;){let n=await this._blockhashWithExpiryBlockHeight(r);if(e.lastValidBlockHeight=n.lastValidBlockHeight,e.recentBlockhash=n.blockhash,e.sign(...t),!e.signature)throw Error("!signature");let i=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(i))r=!0;else{this._blockhashInfo.transactionSignatures.push(i);break}}}let n=e.serialize();return await this.sendRawTransaction(n,r)}async sendRawTransaction(e,t){let r=es(e).toString("base64");return await this.sendEncodedTransaction(r,t)}async sendEncodedTransaction(e,t){let r={encoding:"base64"},n=t&&t.skipPreflight,i=!0===n?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(r.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(r.minContextSlot=t.minContextSlot),n&&(r.skipPreflight=n),i&&(r.preflightCommitment=i);let s=[e,r],o=await this._rpcRequest("sendTransaction",s),a=(0,v.create)(o,rS);if("error"in a){let e;throw"data"in a.error&&(e=a.error.data.logs),new eU({action:n?"send":"simulate",signature:"",transactionMessage:a.error.message,logs:e})}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3===e)?this._updateSubscriptions():(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([e,t])=>{this._setSubscription(e,{...t,state:"pending"})}))}_setSubscription(e,t){let r=this._subscriptionsByHash[e]?.state;if(this._subscriptionsByHash[e]=t,r!==t.state){let r=this._subscriptionStateChangeCallbacksByHash[e];r&&r.forEach(e=>{try{e(t.state)}catch{}})}}_onSubscriptionStateChange(e,t){let r=this._subscriptionHashByClientSubscriptionId[e];if(null==r)return()=>{};let n=this._subscriptionStateChangeCallbacksByHash[r]||=new Set;return n.add(t),()=>{n.delete(t),0===n.size&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}},500));return}if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();let e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{let r=this._subscriptionsByHash[e];if(void 0!==r)switch(r.state){case"pending":case"unsubscribed":if(0===r.callbacks.size){delete this._subscriptionsByHash[e],"unsubscribed"===r.state&&delete this._subscriptionCallbacksByServerSubscriptionId[r.serverSubscriptionId],await this._updateSubscriptions();return}await (async()=>{let{args:n,method:i}=r;try{this._setSubscription(e,{...r,state:"subscribing"});let t=await this._rpcWebSocket.call(i,n);this._setSubscription(e,{...r,serverSubscriptionId:t,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[t]=r.callbacks,await this._updateSubscriptions()}catch(s){if(console.error(`Received ${s instanceof Error?"":"JSON-RPC "}error calling \`${i}\``,{args:n,error:s}),!t())return;this._setSubscription(e,{...r,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===r.callbacks.size&&await (async()=>{let{serverSubscriptionId:n,unsubscribeMethod:i}=r;if(this._subscriptionsAutoDisposedByRpc.has(n))this._subscriptionsAutoDisposedByRpc.delete(n);else{this._setSubscription(e,{...r,state:"unsubscribing"}),this._setSubscription(e,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[n])}catch(n){if(n instanceof Error&&console.error(`${i} error:`,n.message),!t())return;this._setSubscription(e,{...r,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(e,{...r,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(e,t){let r=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==r&&r.forEach(e=>{try{e(...t)}catch(e){console.error(e)}})}_wsOnAccountNotification(e){let{result:t,subscription:r}=(0,v.create)(e,tq);this._handleServerNotification(r,[t.value,t.context])}_makeSubscription(e,t){let r=this._nextClientSubscriptionId++,n=eH([e.method,t]),i=this._subscriptionsByHash[n];return void 0===i?this._subscriptionsByHash[n]={...e,args:t,callbacks:new Set([e.callback]),state:"pending"}:i.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let t=this._subscriptionsByHash[n];eb(void 0!==t,`Could not find a \`Subscription\` when tearing down client subscription #${r}`),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(e,t,r){let{commitment:n,config:i}=e5(r),s=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",i);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},s)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){let{result:t,subscription:r}=(0,v.create)(e,tF);this._handleServerNotification(r,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,r,n){let{commitment:i,config:s}=e5(r),o=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",s||(n?{filters:e8(n)}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},o)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,r){let n=this._buildArgs(["object"==typeof e?{mentions:[e.toString()]}:e],r||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){let{result:t,subscription:r}=(0,v.create)(e,rA);this._handleServerNotification(r,[t.value,t.context])}_wsOnSlotNotification(e){let{result:t,subscription:r}=(0,v.create)(e,tW);this._handleServerNotification(r,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){let{result:t,subscription:r}=(0,v.create)(e,tK);this._handleServerNotification(r,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){let r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${t}' events could not be found.`)}_buildArgs(e,t,r,n){let i=t||this._commitment;if(i||r||n){let t={};r&&(t.encoding=r),i&&(t.commitment=i),n&&(t=Object.assign(t,n)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,r,n){let i=t||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,r,n)}_wsOnSignatureNotification(e){let{result:t,subscription:r}=(0,v.create)(e,tV);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,r){let n=this._buildArgs([e],r||this._commitment||"finalized"),i=this._makeSubscription({callback:(e,r)=>{if("status"===e.type){t(e.result,r);try{this.removeSignatureListener(i)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return i}onSignatureWithOptions(e,t,r){let{commitment:n,...i}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},s=this._buildArgs([e],n,void 0,i),o=this._makeSubscription({callback:(e,r)=>{t(e,r);try{this.removeSignatureListener(o)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return o}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){let{result:t,subscription:r}=(0,v.create)(e,tH);this._handleServerNotification(r,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}}class rM{constructor(e){this._keypair=void 0,this._keypair=e??ee()}static generate(){return new rM(ee())}static fromSecretKey(e,t){if(64!==e.byteLength)throw Error("bad secret key size");let r=e.slice(32,64);if(!t||!t.skipValidation){let t=et(e.slice(0,32));for(let e=0;e<32;e++)if(r[e]!==t[e])throw Error("provided secretKey is invalid")}return new rM({publicKey:r,secretKey:e})}static fromSeed(e){let t=et(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),new rM({publicKey:t,secretKey:r})}get publicKey(){return new el(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:y.struct([y.u32("instruction"),eW("recentSlot"),y.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:y.struct([y.u32("instruction")])},ExtendLookupTable:{index:2,layout:y.struct([y.u32("instruction"),eW(),y.seq(ep(),y.offset(y.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:y.struct([y.u32("instruction")])},CloseLookupTable:{index:4,layout:y.struct([y.u32("instruction")])}}),new el("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:y.struct([y.u8("instruction"),y.u32("units"),y.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:y.struct([y.u8("instruction"),y.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:y.struct([y.u8("instruction"),y.u32("units")])},SetComputeUnitPrice:{index:3,layout:y.struct([y.u8("instruction"),eW("microLamports")])}}),new el("ComputeBudget111111111111111111111111111111");let rT=y.struct([y.u8("numSignatures"),y.u8("padding"),y.u16("signatureOffset"),y.u16("signatureInstructionIndex"),y.u16("publicKeyOffset"),y.u16("publicKeyInstructionIndex"),y.u16("messageDataOffset"),y.u16("messageDataSize"),y.u16("messageInstructionIndex")]);class rO{constructor(){}static createInstructionWithPublicKey(e){let{publicKey:t,message:r,signature:n,instructionIndex:i}=e;eb(32===t.length,`Public Key must be 32 bytes but received ${t.length} bytes`),eb(64===n.length,`Signature must be 64 bytes but received ${n.length} bytes`);let s=rT.span,o=s+t.length,a=o+n.length,u=f.Buffer.alloc(a+r.length),l=null==i?65535:i;return rT.encode({numSignatures:1,padding:0,signatureOffset:o,signatureInstructionIndex:l,publicKeyOffset:s,publicKeyInstructionIndex:l,messageDataOffset:a,messageDataSize:r.length,messageInstructionIndex:l},u),u.fill(t,s),u.fill(n,o),u.fill(r,a),new eI({keys:[],programId:rO.programId,data:u})}static createInstructionWithPrivateKey(e){let{privateKey:t,message:r,instructionIndex:n}=e;eb(64===t.length,`Private key must be 64 bytes but received ${t.length} bytes`);try{let e=rM.fromSecretKey(t),i=e.publicKey.toBytes(),s=en(r,e.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:r,signature:s,instructionIndex:n})}catch(e){throw Error(`Error creating instruction; ${e}`)}}}rO.programId=new el("Ed25519SigVerify111111111111111111111111111"),Y.utils.isValidPrivateKey;let rR=Y.getPublicKey,rP=y.struct([y.u8("numSignatures"),y.u16("signatureOffset"),y.u8("signatureInstructionIndex"),y.u16("ethAddressOffset"),y.u8("ethAddressInstructionIndex"),y.u16("messageDataOffset"),y.u16("messageDataSize"),y.u8("messageInstructionIndex"),y.blob(20,"ethAddress"),y.blob(64,"signature"),y.u8("recoveryId")]);class rC{constructor(){}static publicKeyToEthAddress(e){eb(64===e.length,`Public key must be 64 bytes but received ${e.length} bytes`);try{return f.Buffer.from((0,A.keccak_256)(es(e))).slice(-20)}catch(e){throw Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(e){let{publicKey:t,message:r,signature:n,recoveryId:i,instructionIndex:s}=e;return rC.createInstructionWithEthAddress({ethAddress:rC.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:i,instructionIndex:s})}static createInstructionWithEthAddress(e){let t,{ethAddress:r,message:n,signature:i,recoveryId:s,instructionIndex:o=0}=e;eb(20===(t="string"==typeof r?r.startsWith("0x")?f.Buffer.from(r.substr(2),"hex"):f.Buffer.from(r,"hex"):r).length,`Address must be 20 bytes but received ${t.length} bytes`);let a=12+t.length,u=a+i.length+1,l=f.Buffer.alloc(rP.span+n.length);return rP.encode({numSignatures:1,signatureOffset:a,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:es(i),ethAddress:es(t),recoveryId:s},l),l.fill(es(n),rP.span),new eI({keys:[],programId:rC.programId,data:l})}static createInstructionWithPrivateKey(e){let{privateKey:t,message:r,instructionIndex:n}=e;eb(32===t.length,`Private key must be 32 bytes but received ${t.length} bytes`);try{var i;let e,s=es(t),o=rR(s,!1).slice(1),[a,u]=(i=f.Buffer.from((0,A.keccak_256)(es(r))),[(e=Y.sign(i,s)).toCompactRawBytes(),e.recovery]);return this.createInstructionWithPublicKey({publicKey:o,message:r,signature:a,recoveryId:u,instructionIndex:n})}catch(e){throw Error(`Error creating instruction; ${e}`)}}}rC.programId=new el("KeccakSecp256k11111111111111111111111111111");let rU=new el("StakeConfig11111111111111111111111111111111");class rL{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}rL.default=new rL(0,0,el.default);let rN=Object.freeze({Initialize:{index:0,layout:y.struct([y.u32("instruction"),((e="authorized")=>y.struct([ep("staker"),ep("withdrawer")],e))(),((e="lockup")=>y.struct([y.ns64("unixTimestamp"),y.ns64("epoch"),ep("custodian")],e))()])},Authorize:{index:1,layout:y.struct([y.u32("instruction"),ep("newAuthorized"),y.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:y.struct([y.u32("instruction")])},Split:{index:3,layout:y.struct([y.u32("instruction"),y.ns64("lamports")])},Withdraw:{index:4,layout:y.struct([y.u32("instruction"),y.ns64("lamports")])},Deactivate:{index:5,layout:y.struct([y.u32("instruction")])},Merge:{index:7,layout:y.struct([y.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:y.struct([y.u32("instruction"),ep("newAuthorized"),y.u32("stakeAuthorizationType"),em("authoritySeed"),ep("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class rj{constructor(){}static initialize(e){let{stakePubkey:t,authorized:r,lockup:n}=e,i=n||rL.default,s=ez(rN.Initialize,{authorized:{staker:es(r.staker.toBuffer()),withdrawer:es(r.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:es(i.custodian.toBuffer())}});return new eI({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:eP,isSigner:!1,isWritable:!1}],programId:this.programId,data:s})}static createAccountWithSeed(e){let t=new eM;t.add(eK.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:n,lockup:i}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static createAccount(e){let t=new eM;t.add(eK.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:n,lockup:i}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static delegate(e){let{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,i=ez(rN.Delegate);return new eM().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:eC,isSigner:!1,isWritable:!1},{pubkey:rU,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(e){let{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:i,custodianPubkey:s}=e,o=ez(rN.Authorize,{newAuthorized:es(n.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:eO,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new eM().add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(e){let{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:i,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=e,u=ez(rN.AuthorizeWithSeed,{newAuthorized:es(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:n,authorityOwner:es(i.toBuffer())}),l=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:eO,isSigner:!1,isWritable:!1}];return a&&l.push({pubkey:a,isSigner:!0,isWritable:!1}),new eM().add({keys:l,programId:this.programId,data:u})}static splitInstruction(e){let{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:i}=e,s=ez(rN.Split,{lamports:i});return new eI({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(e,t){let r=new eM;return r.add(eK.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space
7:this.space,programId:this.programId})),r.add(this.splitInstruction(e))}static splitWithSeed(e,t){let{stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,basePubkey:s,seed:o,lamports:a}=e,u=new eM;return u.add(eK.allocate({accountPubkey:i,basePubkey:s,seed:o,space:this.space,programId:this.programId})),t&&t>0&&u.add(eK.transfer({fromPubkey:e.authorizedPubkey,toPubkey:i,lamports:t})),u.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,lamports:a}))}static merge(e){let{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,i=ez(rN.Merge);return new eM().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:eC,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(e){let{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:i,custodianPubkey:s}=e,o=ez(rN.Withdraw,{lamports:i}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:eC,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new eM().add({keys:a,programId:this.programId,data:o})}static deactivate(e){let{stakePubkey:t,authorizedPubkey:r}=e,n=ez(rN.Deactivate);return new eM().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}}rj.programId=new el("Stake11111111111111111111111111111111111111"),rj.space=200;let rz=Object.freeze({InitializeAccount:{index:0,layout:y.struct([y.u32("instruction"),((e="voteInit")=>y.struct([ep("nodePubkey"),ep("authorizedVoter"),ep("authorizedWithdrawer"),y.u8("commission")],e))()])},Authorize:{index:1,layout:y.struct([y.u32("instruction"),ep("newAuthorized"),y.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:y.struct([y.u32("instruction"),y.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:y.struct([y.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:y.struct([y.u32("instruction"),((e="voteAuthorizeWithSeedArgs")=>y.struct([y.u32("voteAuthorizationType"),ep("currentAuthorityDerivedKeyOwnerPubkey"),em("currentAuthorityDerivedKeySeed"),ep("newAuthorized")],e))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class rq{constructor(){}static initializeAccount(e){let{votePubkey:t,nodePubkey:r,voteInit:n}=e,i=ez(rz.InitializeAccount,{voteInit:{nodePubkey:es(n.nodePubkey.toBuffer()),authorizedVoter:es(n.authorizedVoter.toBuffer()),authorizedWithdrawer:es(n.authorizedWithdrawer.toBuffer()),commission:n.commission}});return new eI({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:eP,isSigner:!1,isWritable:!1},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static createAccount(e){let t=new eM;return t.add(eK.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){let{votePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,voteAuthorizationType:i}=e,s=ez(rz.Authorize,{newAuthorized:es(n.toBuffer()),voteAuthorizationType:i.index});return new eM().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static authorizeWithSeed(e){let{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:i,voteAuthorizationType:s,votePubkey:o}=e,a=ez(rz.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:es(r.toBuffer()),currentAuthorityDerivedKeySeed:n,newAuthorized:es(i.toBuffer()),voteAuthorizationType:s.index}});return new eM().add({keys:[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:eO,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}static withdraw(e){let{votePubkey:t,authorizedWithdrawerPubkey:r,lamports:n,toPubkey:i}=e,s=ez(rz.Withdraw,{lamports:n});return new eM().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static safeWithdraw(e,t,r){if(e.lamports>t-r)throw Error("Withdraw will leave vote account with insufficient funds.");return rq.withdraw(e)}static updateValidatorIdentity(e){let{votePubkey:t,authorizedWithdrawerPubkey:r,nodePubkey:n}=e,i=ez(rz.UpdateValidatorIdentity);return new eM().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}}rq.programId=new el("Vote111111111111111111111111111111111111111"),rq.space=3762,new el("Va1idator1nfo111111111111111111111111111111"),(0,v.type)({name:(0,v.string)(),website:(0,v.optional)((0,v.string)()),details:(0,v.optional)((0,v.string)()),iconUrl:(0,v.optional)((0,v.string)()),keybaseUsername:(0,v.optional)((0,v.string)())}),new el("Vote111111111111111111111111111111111111111"),y.struct([ep("nodePubkey"),ep("authorizedWithdrawer"),y.u8("commission"),y.nu64(),y.seq(y.struct([y.nu64("slot"),y.u32("confirmationCount")]),y.offset(y.u32(),-8),"votes"),y.u8("rootSlotValid"),y.nu64("rootSlot"),y.nu64(),y.seq(y.struct([y.nu64("epoch"),ep("authorizedVoter")]),y.offset(y.u32(),-8),"authorizedVoters"),y.struct([y.seq(y.struct([ep("authorizedPubkey"),y.nu64("epochOfLastAuthorizedSwitch"),y.nu64("targetEpoch")]),32,"buf"),y.nu64("idx"),y.u8("isEmpty")],"priorVoters"),y.nu64(),y.seq(y.struct([y.nu64("epoch"),y.nu64("credits"),y.nu64("prevCredits")]),y.offset(y.u32(),-8),"epochCredits"),y.struct([y.nu64("slot"),y.nu64("timestamp")],"lastTimestamp")]);let rZ=e=>({request:e,signMessage:t=>e({method:"signMessage",params:{message:t}}),signTransaction:t=>e({method:"signTransaction",params:{transaction:t}}),signAndSendTransaction:t=>e({method:"signAndSendTransaction",params:t})});e.s(["createSolanaWalletProvider",0,rZ],27214);var rF=e.i(67034);function rD(e){return rF.Buffer.from(e.serialize({verifySignatures:!1})).toString("base64")}function rW(e){let t=rF.Buffer.from(e,"base64");return"legacy"===eE.deserializeMessageVersion(t)?eT.deserialize(t):eM.from(t)}function r$(e){return async t=>{if("connect"===t.method||"signMessage"===t.method)return await e(t);if("signAndSendTransaction"===t.method){let{transaction:r,options:n}=t.params,i={transaction:rW(r),options:n};return await e({method:"signAndSendTransaction",params:i})}if("signTransaction"===t.method){let{transaction:r}=t.params,n={transaction:rW(r)},{signedTransaction:i}=await e({method:"signTransaction",params:n});return{signedTransaction:rD(i)}}}}function rK(e){return async t=>{if("connect"===t.method||"signMessage"===t.method)return await e(t);if("signAndSendTransaction"===t.method){let{transaction:r}=t.params,n={transaction:rD(r)};return await e({method:"signAndSendTransaction",params:n})}if("signTransaction"===t.method){let{transaction:r}=t.params,n={transaction:rD(r)},{signedTransaction:i}=await e({method:"signTransaction",params:n});return{signedTransaction:rW(i)}}}}
7e.s(["unwrapSolanaProviderRequest",()=>rK,"wrapSolanaProviderRequest",()=>r$],75522),e.i(37904),e.i(39879),e.s([],91158),e.s([],60519);var rV=e.i(37789),rH=e.i(18744),rG=e.i(67924),rJ=e.i(57615),rY=e.i(42283),rX=e.i(6452),rQ=e.i(31687),r0=e.i(43778),r1=e.i(2578),r2=e.i(52474),r6=e.i(55235),r3=e.i(69620),r5=e.i(31130);e.s(["AddMiniApp",0,rV,"ComposeCast",0,rH,"Haptics",0,rG,"OpenMiniApp",0,rJ,"Ready",0,rY,"RequestCameraAndMicrophoneAccess",0,rX,"SendToken",0,rQ,"SignIn",0,r0,"SignManifest",0,r1,"SwapToken",0,r2,"ViewCast",0,r6,"ViewProfile",0,r3,"ViewToken",0,r5],68542);var rV=rV;class r8 extends Error{constructor(e,t={}){const r=(()=>{if(t.cause instanceof r8){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause?.message?t.cause.message:t.details})(),n=t.cause instanceof r8&&t.cause.docsPath||t.docsPath,i=`https://oxlib.sh${n??""}`;super([e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...r||n?["",r?`Details: ${r}`:void 0,n?`See: ${i}`:void 0]:[]].filter(e=>"string"==typeof e).join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"[email protected]"}),this.cause=t.cause,this.details=r,this.docs=i,this.docsPath=n,this.shortMessage=e}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&t.cause?e(t.cause,r):r?null:t}(this,e)}}function r4(e,t={}){let{raw:r=!1}=t;if(r)return e;if(e.error){let{code:t}=e.error;throw new(t===nl.code?nl:t===r7.code?r7:t===nu.code?nu:t===no.code?no:t===ni.code?ni:t===na.code?na:t===nn.code?nn:t===nc.code?nc:t===ne.code?ne:t===nt.code?nt:t===nr.code?nr:t===ns.code?ns:r9)(e.error)}return e.result}class r9 extends Error{constructor(e){const{code:t,message:r,data:n}=e;super(r),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.BaseError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t,this.data=n}}class r7 extends r9{constructor(e={}){super({message:"Missing or invalid parameters.",...e,code:r7.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidInputError"})}}Object.defineProperty(r7,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ne extends r9{constructor(e={}){super({message:"Requested resource not found.",...e,code:ne.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ResourceNotFoundError"})}}Object.defineProperty(ne,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class nt extends r9{constructor(e={}){super({message:"Requested resource not available.",...e,code:nt.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ResourceUnavailableError"})}}Object.defineProperty(nt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class nr extends r9{constructor(e={}){super({message:"Transaction creation failed.",...e,code:nr.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.TransactionRejectedError"})}}Object.defineProperty(nr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});
7class nn extends r9{constructor(e={}){super({message:"Method is not implemented.",...e,code:nn.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.MethodNotSupportedError"})}}Object.defineProperty(nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class ni extends r9{constructor(e={}){super({message:"Rate limit exceeded.",...e,code:ni.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.LimitExceededError"})}}Object.defineProperty(ni,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class ns extends r9{constructor(e={}){super({message:"JSON-RPC version not supported.",...e,code:ns.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.VersionNotSupportedError"})}}Object.defineProperty(ns,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class no extends r9{constructor(e={}){super({message:"Input is not a valid JSON-RPC request.",...e,code:no.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidRequestError"})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class na extends r9{constructor(e={}){super({message:"Method does not exist.",...e,code:na.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.MethodNotFoundError"})}}Object.defineProperty(na,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class nu extends r9{constructor(e={}){super({message:"Invalid method parameters.",...e,code:nu.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidParamsError"})}}Object.defineProperty(nu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class nl extends r9{constructor(e={}){super({message:"Internal JSON-RPC error.",...e,code:nl.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InternalErrorError"})}}Object.defineProperty(nl,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class nc extends r9{constructor(e={}){super({message:"Failed to parse JSON-RPC response.",...e,code:nc.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ParseError"})}}Object.defineProperty(nc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class nf extends Error{constructor(e,t){super(t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=e,this.details=t}}class nh extends nf{constructor({message:e="The user rejected the request."}={}){super(4001,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UserRejectedRequestError"})}}Object.defineProperty(nh,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class nd extends nf{constructor({message:e="The requested method and/or account has not been authorized by the user."}={}){super(4100,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnauthorizedError"})}}Object.defineProperty(nd,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});
7class np extends nf{constructor({message:e="The provider does not support the requested method."}={}){super(4200,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnsupportedMethodError"})}}Object.defineProperty(np,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class nm extends nf{constructor({message:e="The provider is disconnected from all chains."}={}){super(4900,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.DisconnectedError"})}}Object.defineProperty(nm,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ng extends nf{constructor({message:e="The provider is not connected to the requested chain."}={}){super(4901,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.ChainDisconnectedError"})}}Object.defineProperty(ng,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ny extends r8{constructor(){super("`provider` is undefined."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.IsUndefinedError"})}}let nb=Symbol("Comlink.proxy"),nv=Symbol("Comlink.endpoint"),nw=Symbol("Comlink.releaseProxy"),n_=Symbol("Comlink.finalizer"),nx=Symbol("Comlink.thrown"),nk=e=>"object"==typeof e&&null!==e||"function"==typeof e,nS=new Map([["proxy",{canHandle:e=>nk(e)&&e[nb],serialize(e){let{port1:t,port2:r}=new MessageChannel;return function e(t,r=globalThis,n=["*"]){r.addEventListener("message",function i(s){let o;if(!s||!s.data)return;if(!function(e,t){for(let r of e)if(t===r||"*"===r||r instanceof RegExp&&r.test(t))return!0;return!1}(n,s.origin))return void console.warn(`Invalid origin '${s.origin}' for comlink proxy`);let{id:a,type:u,path:l}=Object.assign({path:[]},s.data),c=(s.data.argumentList||[]).map(nC);try{var f,h,d;let r=l.slice(0,-1).reduce((e,t)=>e[t],t),n=l.reduce((e,t)=>e[t],t);switch(u){case"GET":o=n;break;case"SET":r[l.slice(-1)[0]]=nC(s.data.value),o=!0;break;case"APPLY":o=n.apply(r,c);break;case"CONSTRUCT":f=new n(...c),o=Object.assign(f,{[nb]:!0});break;case"ENDPOINT":{let{port1:r,port2:n}=new MessageChannel;e(t,n),h=r,d=[r],nR.set(h,d),o=h}break;case"RELEASE":o=void 0;break;default:return}}catch(e){o={value:e,[nx]:0}}Promise.resolve(o).catch(e=>({value:e,[nx]:0})).then(e=>{let[n,s]=nP(e);r.postMessage(Object.assign(Object.assign({},n),{id:a}),s),"RELEASE"===u&&(r.removeEventListener("message",i),nE(r),n_ in t&&"function"==typeof t[n_]&&t[n_]())}).catch(e=>{let[t,n]=nP({value:TypeError("Unserializable return value"),[nx]:0});r.postMessage(Object.assign(Object.assign({},t),{id:a}),n)})}),r.start&&r.start()}(e,t),[r,[r]]},deserialize:e=>(e.start(),nA(e))}],["throw",{canHandle:e=>nk(e)&&nx in e,serialize:({value:e})=>[e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[]],deserialize(e){if(e.isError)throw Object.assign(Error(e.value.message),e.value);throw e.value}}]]);function nE(e){"MessagePort"===e.constructor.name&&e.close()}function nA(e,t){let r=new Map;return e.addEventListener("message",function(e){let{data:t}=e;if(!t||!t.id)return;let n=r.get(t.id);if(n)try{n(t)}finally{r.delete(t.id)}}),function e(t,r,n=[],i=function(){}){let s,o=!1,a=new Proxy(i,{get(i,s){if(nB(o),s===nw)return()=>{nT&&nT.unregister(a),nI(t),r.clear(),o=!0};if("then"===s){if(0===n.length)return{then:()=>a};let e=nU(t,r,{type:"GET",path:n.map(e=>e.toString())}).then(nC);return e.then.bind(e)}return e(t,r,[...n,s])},set(e,i,s){nB(o);let[a,u]=nP(s);return nU(t,r,{type:"SET",path:[...n,i].map(e=>e.toString()),value:a},u).then(nC)},apply(i,s,a){nB(o);let u=n[n.length-1];if(u===nv)return nU(t,r,{type:"ENDPOINT"}).then(nC);if("bind"===u)return e(t,r,n.slice(0,-1));let[l,c]=nO(a);return nU(t,r,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:l},c).then(nC)},construct(e,i){nB(o);let[s,a]=nO(i);return nU(t,r,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:s},a).then(nC)}});return s=(nM.get(t)||0)+1,nM.set(t,s),nT&&nT.register(a,t,a),a}(e,r,[],t)}function nB(e){if(e)throw Error("Proxy has been released and is not useable")}function nI(e){return nU(e,new Map,{type:"RELEASE"}).then(()=>{nE(e)})}let nM=new WeakMap,nT="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{let t=(nM.get(e)||0)-1;nM.set(e,t),0===t&&nI(e)});function nO(e){var t;let r=e.map(nP);return[r.map(e=>e[0]),(t=r.map(e=>e[1]),Array.prototype.concat.apply([],t))]}let nR=new WeakMap;function nP(e){for(let[t,r]of nS)if(r.canHandle(e)){let[n,i]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:e},nR.get(e)||[]]}function nC(e){switch(e.type){case"HANDLER":return nS.get(e.name).deserialize(e.value);case"RAW":return e.value}}function nU(e,t,r,n){return new Promise(i=>{let s=[,,,,].fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(s,i),e.start&&e.start(),e.postMessage(Object.assign({id:s},r),n)})}let nL=nA("undefined"==typeof window?{postMessage(){},addEventListener:()=>{},removeEventListener:()=>{}}:window?.ReactNativeWebView?{postMessage:e=>{window.ReactNativeWebView.postMessage(JSON.stringify(e))},addEventListener:(e,t,...r)=>{document.addEventListener("FarcasterFrameCallback",t,...r)},removeEventListener:(e,t)=>{document.removeEventListener("FarcasterFrameCallback",t)}}
7:function(e,t=globalThis,r="*"){return{postMessage:(t,n)=>e.postMessage(t,r,n),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}(window?.parent??window));e.s(["frameHost",0,nL,"miniAppHost",0,nL],60576);let nN={get eventNames(){return n.eventNames.bind(n)},get listenerCount(){return n.listenerCount.bind(n)},get listeners(){return n.listeners.bind(n)},addListener:(n=new x.EventEmitter).addListener.bind(n),emit:n.emit.bind(n),off:n.off.bind(n),on:n.on.bind(n),once:n.once.bind(n),removeAllListeners:n.removeAllListeners.bind(n),removeListener:n.removeListener.bind(n)},nj=function(e={}){let t=e.id??0;return{prepare:e=>({...{id:t++,...e},jsonrpc:"2.0"}),get id(){return t}}}(),nz=function(e,t={}){let{includeEvents:r=!0}=t;if(!e)throw new ny;return{...r?{on:e.on?.bind(e),removeListener:e.removeListener?.bind(e)}:{},async request(t){let r=await e.request(t);return r&&"object"==typeof r&&"jsonrpc"in r?r4(r):r}}}({...nN,async request(e){let t=nj.prepare(e);try{let e=await nL.ethProviderRequestV2(t).then(e=>r4(e,{request:t,raw:!0}));if(e.error)throw function({code:e,details:t}){switch(e){case 4001:return new nh;case 4100:return new nd;case 4200:return new np;case 4900:return new nm;case 4901:return new ng;default:return new nf(e,t??"Unknown provider RPC error")}}(e.error);return e.result}catch(e){if(e instanceof Error&&e.message.match(/cannot read property 'apply'/i))return await nL.ethProviderRequest(t);if(e instanceof nf||e instanceof r9)throw e;throw new nl({message:e instanceof Error?e.message:void 0})}}});async function nq(){try{let e=await nL.getCapabilities();if(!e.includes("wallet.getEthereumProvider")&&!e.includes("wallet.getEvmProvider"))return;return nz}catch{return nz}}function nZ(e){let t=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(e)});window.dispatchEvent(t);let r=()=>window.dispatchEvent(t);return window.addEventListener("eip6963:requestProvider",r),()=>window.removeEventListener("eip6963:requestProvider",r)}"undefined"!=typeof document&&(document.addEventListener("eip6963:requestProvider",()=>{nL.eip6963RequestProvider()}),document.addEventListener("FarcasterFrameEthProviderEvent",e=>{if(e instanceof MessageEvent){let t=e.data;nN.emit(t.event,...t.params)}}),document.addEventListener("FarcasterFrameEvent",e=>{if(e instanceof MessageEvent){let t=e.data;"eip6963:announceProvider"===t.event&&nZ({info:t.info,provider:nz})}})),"undefined"!=typeof window&&(window.addEventListener("eip6963:requestProvider",()=>{nL.eip6963RequestProvider()}),window.addEventListener("message",e=>{if(e instanceof MessageEvent&&"frameEthProviderEvent"===e.data.type){let t=e.data;nN.emit(t.event,...t.params)}}),window.addEventListener("message",e=>{if(e instanceof MessageEvent&&"frameEvent"===e.data.type){let t=e.data.event;"eip6963:announceProvider"===t.event&&nZ({info:t.info,provider:nz})}}));var r0=r0;crypto,new TextEncoder;let nF=new TextDecoder;class nD extends Error{constructor(e,t){super(e,t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}nD.code="ERR_JOSE_GENERIC";class nW extends nD{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}nW.code="ERR_JWT_INVALID";class n$ extends Error{constructor(e,t={}){const r=(()=>{if(t.cause instanceof n$){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&"string"==typeof t.cause.details?t.cause.details:t.cause?.message?t.cause.message:t.details})();super([e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...r?["",r?`Details: ${r}`:void 0]:[]].filter(e=>"string"==typeof e).join("\n"),t.cause?{cause:t.cause}:void 0),this.name="BaseError",this.cause=t.cause,this.details=r,this.shortMessage=e}}class nK extends n${constructor({status:e}){super(`Request failed with status ${e}`),this.name="RequestFailedError"}}class nV extends n${constructor(e){super(e),this.name="InvalidToken"}}async function nH({origin:e}){let t=await fetch(`${e}/nonce`,{method:"POST"});if(!t.ok)throw new nK({status:t.status});return await t.json()}async function nG({origin:e},t){let r=await fetch(`${e}/verify-siwf`,{method:"POST",headers:new Headers({"Content-Type":"application/json"}),body:JSON.stringify(t)});if(!r.ok)throw new nK({status:r.status});let n=await r.json();if(!1===n.valid)throw new nV(n.message??"unknown");return{token:n.token}}I.abytes,I.anumber,I.bytesToHex,I.bytesToUtf8,I.concatBytes,I.hexToBytes,I.isBytes,I.randomBytes,I.utf8ToBytes,T.abool,T.numberToHexUnpadded,T.hexToNumber,T.bytesToNumberBE,T.bytesToNumberLE,T.numberToBytesBE,T.numberToBytesLE,T.numberToVarBytesBE,T.ensureBytes,T.equalBytes,T.copyBytes,T.asciiToBytes,T.inRange,T.aInRange,T.bitLen,T.bitGet,T.bitSet,T.bitMask,T.createHmacDrbg,T.notImplemented,T.memoized,T.validateObject,T.isHash;
7class nJ extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}({checksum:new nJ(8192)}).checksum;var nY=e.i(40893);let nX=Uint32Array.from([0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0]),nQ=new Uint32Array(80);nY.HashMD;(e,t)=>Math.floor(0x100000000*Math.abs(Math.sin(t+1)));nY.HashMD;let n0=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),n1=Uint8Array.from(Array(16).fill(0).map((e,t)=>t)),n2=n1.map(e=>(9*e+5)%16),n6=(()=>{let e=[[n1],[n2]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>n0[e]));return e})(),n3=n6[0],n5=n6[1],n8=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),n4=n3.map((e,t)=>e.map(e=>n8[t][e])),n9=n5.map((e,t)=>e.map(e=>n8[t][e])),n7=Uint32Array.from([0,0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xa953fd4e]),ie=Uint32Array.from([0x50a28be6,0x5c4dd124,0x6d703ef3,0x7a6d76e9,0]);nY.HashMD;let it=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,ir=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/,ii=(()=>{let e,t;async function r(t){let r=function(e={}){let t=function(e={}){return{origin:e.origin??"https://auth.farcaster.xyz"}}(e);return{generateNonce:()=>nH(t),verifySiwf:e=>nG(t,e)}}({origin:t.quickAuthServerOrigin}),{nonce:n}=await r.generateNonce(),i=await nL.signIn({nonce:n,acceptAuthAddress:!0});if(i.result){let t=function(e){let{scheme:t,statement:r,...n}=e.match(it)?.groups??{},{chainId:i,expirationTime:s,issuedAt:o,notBefore:a,requestId:u,...l}=e.match(ir)?.groups??{},c=e.split("Resources:")[1]?.split("\n- ").slice(1);return{...n,...l,...i?{chainId:Number(i)}:{},...s?{expirationTime:new Date(s)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...u?{requestId:u}:{},...c?{resources:c}:{},...t?{scheme:t}:{},...r?{statement:r}:{}}}(i.result.message);if(!t.domain)throw Error("Missing domain on SIWE message");let n=await r.verifySiwf({domain:t.domain,message:i.result.message,signature:i.result.signature});return e={token:n.token,payload:function(e){let t,r;if("string"!=typeof e)throw new nW("JWTs must use Compact JWS serialization, JWT must be a string");let{1:n,length:i}=e.split(".");if(5===i)throw new nW("Only JWTs using Compact JWS serialization can be decoded");if(3!==i)throw new nW("Invalid JWT");if(!n)throw new nW("JWTs must contain a payload");try{t=(e=>{let t=e;t instanceof Uint8Array&&(t=nF.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{var r=t;let e=atob(r),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}catch{throw TypeError("The input to be decoded is not correctly encoded.")}})(n)}catch{throw new nW("Failed to base64url decode the payload")}try{r=JSON.parse(nF.decode(t))}catch{throw new nW("Failed to parse the decoded payload as JSON")}if(!function(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(r))throw new nW("Invalid JWT Claims Set");return r}(n.token)},n}if("rejected_by_user"===i.error.type)throw new r0.RejectedByUser;throw Error("Unreachable")}return{get token(){if(e&&new Date(1e3*e.payload.exp)>new Date(Date.now()+15e3))return e.token;return},async getToken(n={}){let i=n.force??!1;return e&&!i&&new Date(1e3*e.payload.exp)>new Date(Date.now()+15e3)?{token:e.token}:(t||(t=r(n)),t.finally(()=>{t=void 0}),t)},async fetch(e,t){let{token:r}=await this.getToken(),n=new Headers(t?.headers);return n.set("Authorization",`Bearer ${r}`),fetch(e,{...t,headers:n})}}})();e.s(["quickAuth",0,ii],92209);let is={get eventNames(){return i.eventNames.bind(i)},get listenerCount(){return i.listenerCount.bind(i)},get listeners(){return i.listeners.bind(i)},addListener:(i=new _.default).addListener.bind(i),emit:i.emit.bind(i),off:i.off.bind(i),on:i.on.bind(i),once:i.once.bind(i),removeAllListeners:i.removeAllListeners.bind(i),removeListener:i.removeListener.bind(i)};e.i(27214),e.s(["SolanaConnection",()=>rI,"createSolanaWalletProvider",0,rZ],36602);
7let{solanaProviderRequest:io}=nL;async function ia(){let e;try{e=await nL.getCapabilities()}catch{}if(e?.includes("wallet.getSolanaProvider"))return t}io&&(t=rZ(rK(io)));let iu=null;async function il(e=1e3){if(!0===iu)return!0;if("undefined"==typeof window||!window.ReactNativeWebView&&window===window.parent)return!1;let t=await Promise.race([nL.context.then(e=>!!e),new Promise(t=>{setTimeout(()=>t(!1),e)})]).catch(()=>!1);return t&&(iu=!0),t}let ic=async()=>{let e=await nL.addFrame();if(e.result)return e.result;if("invalid_domain_manifest"===e.error.type)throw new rV.InvalidDomainManifest;if("rejected_by_user"===e.error.type)throw new rV.RejectedByUser;throw Error("Unreachable")},ih={...is,getCapabilities:nL.getCapabilities,getChains:nL.getChains,isInMiniApp:il,context:nL.context,back:(({miniAppHost:e,emitter:t})=>{let r,n=null;return{visible:!1,get onback(){return n},set onback(cb){n&&t.removeListener("backNavigationTriggered",n),n=cb,cb&&t.addListener("backNavigationTriggered",cb)},async show(){await e.updateBackState({visible:!0}),this.visible=!0},async hide(){await e.updateBackState({visible:!1}),this.visible=!1},async enableWebNavigation(){r=function({emitter:e,back:t}){let r=function(){if("undefined"!=typeof window&&void 0!==window.navigation)return window.navigation}();return r?function({emitter:e,back:t,navigation:r}){function n(){r.canGoBack?t.show():t.hide()}function i(){t.visible&&r.canGoBack&&r.back()}return r.addEventListener("navigatesuccess",n),e.addListener("backNavigationTriggered",i),()=>{r.removeEventListener("navigatesuccess",n),e.removeListener("backNavigationTriggered",i)}}({emitter:e,back:t,navigation:r}):"undefined"!=typeof window?function({emitter:e,back:t,window:r}){function n(){t.visible&&r.history.back()}return t.show(),e.addListener("backNavigationTriggered",n),()=>{e.removeListener("backNavigationTriggered",n)}}({emitter:e,back:t,window}):void 0}({back:this,emitter:t})},async disableWebNavigation(){r?.(),r=void 0}}})({miniAppHost:nL,emitter:is}),quickAuth:ii,actions:{setPrimaryButton:nL.setPrimaryButton.bind(nL),ready:async(e={})=>await nL.ready(e),close:nL.close.bind(nL),viewCast:nL.viewCast.bind(nL),viewProfile:nL.viewProfile.bind(nL),openMiniApp:nL.openMiniApp.bind(nL),signIn:async e=>{let t=await nL.signIn({...e,acceptAuthAddress:e.acceptAuthAddress??!0});if(t.result)return t.result;if("rejected_by_user"===t.error.type)throw new r0.RejectedByUser;throw Error("Unreachable")},openUrl:e=>{let t="string"==typeof e?e:e.url;return nL.openUrl(t.trim())},addFrame:ic,addMiniApp:ic,composeCast:(e={})=>nL.composeCast(e),viewToken:nL.viewToken.bind(nL),sendToken:nL.sendToken.bind(nL),swapToken:nL.swapToken.bind(nL),requestCameraAndMicrophoneAccess:nL.requestCameraAndMicrophoneAccess.bind(nL)},experimental:{getSolanaProvider:ia,signManifest:async e=>{let t=await nL.signManifest(e);if(t.result)return t.result;if("rejected_by_user"===t.error.type)throw new r1.RejectedByUser;if("invalid_domain"===t.error.type)throw new r1.InvalidDomain;if("generic_error"===t.error.type)throw new r1.GenericError(t.error.message);throw Error("Unreachable")},quickAuth:e=>ii.getToken(e)},wallet:{ethProvider:nz,getEthereumProvider:nq,getSolanaProvider:ia},haptics:{impactOccurred:nL.impactOccurred.bind(nL),notificationOccurred:nL.notificationOccurred.bind(nL),selectionChanged:nL.selectionChanged.bind(nL)}};"undefined"!=typeof document&&document.addEventListener("FarcasterFrameEvent",e=>{if(e instanceof MessageEvent){let t=e.data;"primary_button_clicked"===t.event?is.emit("primaryButtonClicked"):"miniapp_added"===t.event?is.emit("miniAppAdded",{notificationDetails:t.notificationDetails}):"miniapp_add_rejected"===t.event?is.emit("miniAppAddRejected",{reason:t.reason}):"miniapp_removed"===t.event?is.emit("miniAppRemoved"):"notifications_enabled"===t.event?is.emit("notificationsEnabled",{notificationDetails:t.notificationDetails}):"notifications_disabled"===t.event?is.emit("notificationsDisabled"):"back_navigation_triggered"===t.event&&is.emit("backNavigationTriggered")}}),"undefined"!=typeof window&&window.addEventListener("message",e=>
7{if(e instanceof MessageEvent&&"frameEvent"===e.data.type){let t=e.data.event;"primary_button_clicked"===t.event?is.emit("primaryButtonClicked"):"miniapp_added"===t.event?is.emit("miniAppAdded",{notificationDetails:t.notificationDetails}):"miniapp_add_rejected"===t.event?is.emit("miniAppAddRejected",{reason:t.reason}):"miniapp_removed"===t.event?is.emit("miniAppRemoved"):"notifications_enabled"===t.event?is.emit("notificationsEnabled",{notificationDetails:t.notificationDetails}):"notifications_disabled"===t.event?is.emit("notificationsDisabled"):"back_navigation_triggered"===t.event&&is.emit("backNavigationTriggered")}}),e.s(["sdk",0,ih],38631),e.s(["default",0,ih],6011)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.