@bonfida/spl-name-service 2.3.3 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ read:function(t,e,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,f=-7,h=r?o-1:0,d=r?
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
9
  */
10
- !function(t){const e=o,r=d,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function s(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=s(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if($(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);const o=function(t){if(a.isBuffer(t)){const e=0|l(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?s(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return u(t),s(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,a.prototype),n}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(o)return n?-1:G(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){let i,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(t,i+n)!==u(e,n)){r=!1;break}if(r)return i}return-1}function v(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(Z(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return Y(G(e,t.length-r),t,r,n)}function x(t,e,r,n){return Y(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return Y(q(e),t,r,n)}function I(t,e,r,n){return Y(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function S(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function B(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(i=c));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}t.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){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(t,e,r){return c(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return f(t)},a.allocUnsafeSlow=function(t){return f(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),$(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).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(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=a.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if($(e,Uint8Array))o+e.length>n.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)w(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,o){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const c=Math.min(i,s),u=this.slice(n,o),f=t.slice(e,r);for(let t=0;t<c;++t)if(u[t]!==f[t]){i=u[t],s=f[t];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=X[t[n]];return o}function _(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function O(t,e,r,n,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function N(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,n,o,i){return e=+e,n>>>=0,i||N(t,0,n,4),r.write(t,e,n,o,23,4),n+4}function M(t,e,n,o,i){return e=+e,n>>>=0,i||N(t,0,n,8),r.write(t,e,n,o,52,8),n+8}a.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),a.prototype.readBigUInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),a.prototype.readBigInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=a.isBuffer(t)?t:a.from(t,n),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%s]}return this};const V={};function z(t,e,r){V[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function j(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||K(e,t.length-(r+1))}(n,o,i)}function F(t,e){if("number"!=typeof t)throw new V.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=W(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(n);const p=new t.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const l=new t.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t.PublicKey("So11111111111111111111111111111111111111112"),new t.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.s16=y.s8=y.nu64be=y.u48be=y.u40be=y.u32be=y.u24be=y.u16be=y.nu64=y.u48=y.u40=tt=y.u32=y.u24=y.u16=J=y.u8=y.offset=y.greedy=y.Constant=y.UTF8=y.CString=y.Blob=y.Boolean=y.BitField=y.BitStructure=y.VariantLayout=y.Union=y.UnionLayoutDiscriminator=y.UnionDiscriminator=y.Structure=y.Sequence=y.DoubleBE=y.Double=y.FloatBE=y.Float=y.NearInt64BE=y.NearInt64=y.NearUInt64BE=y.NearUInt64=y.IntBE=y.Int=y.UIntBE=y.UInt=y.OffsetLayout=y.GreedyCount=y.ExternalLayout=y.bindConstructorLayout=y.nameWithProperty=y.Layout=y.uint8ArrayToBuffer=y.checkUint8Array=void 0,y.constant=y.utf8=y.cstr=rt=y.blob=y.unionLayoutDiscriminator=y.union=y.seq=y.bits=et=y.struct=y.f64be=y.f64=y.f32be=y.f32=y.ns64be=y.s48be=y.s40be=y.s32be=y.s24be=y.s16be=y.ns64=y.s48=y.s40=y.s32=y.s24=void 0;const g=n;function w(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function b(t){return w(t),g.Buffer.from(t.buffer,t.byteOffset,t.length)}y.checkUint8Array=w,y.uint8ArrayToBuffer=b;class m{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function v(t,e){return e.property?t+"["+e.property+"]":t}y.Layout=m,y.nameWithProperty=v,y.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof m))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,r)=>e.decode(t,r),writable:!0})};class E extends m{isCount(){throw new Error("ExternalLayout is abstract")}}y.ExternalLayout=E;class x extends E{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){w(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}y.GreedyCount=x;class A extends E{constructor(t,e=0,r){if(!(t instanceof m))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof I||this.layout instanceof S}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}y.OffsetLayout=A;class I extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntLE(t,r,this.span),this.span}}y.UInt=I;class S extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntBE(t,r,this.span),this.span}}y.UIntBE=S;class B extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeIntLE(t,r,this.span),this.span}}y.Int=B;class R extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeIntBE(t,r,this.span),this.span}}y.IntBE=R;const P=Math.pow(2,32);function k(t){const e=Math.floor(t/P);return{hi32:e,lo32:t-e*P}}function T(t,e){return t*P+e}class _ extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeUInt32LE(n.hi32,r+4),8}}y.NearUInt64=_;class U extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearUInt64BE=U;class L extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeInt32LE(n.hi32,r+4),8}}y.NearInt64=L;class C extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearInt64BE=C;class O extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatLE(e)}encode(t,e,r=0){return b(e).writeFloatLE(t,r),4}}y.Float=O;class N extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatBE(e)}encode(t,e,r=0){return b(e).writeFloatBE(t,r),4}}y.FloatBE=N;class D extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleLE(e)}encode(t,e,r=0){return b(e).writeDoubleLE(t,r),8}}y.Double=D;class M extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleBE(e)}encode(t,e,r=0){return b(e).writeDoubleBE(t,r),8}}y.DoubleBE=M;class V extends m{constructor(t,e,r){if(!(t instanceof m))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof E&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(e instanceof E)&&0<t.span&&(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof E&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let o=0;for(;o<n;)r+=this.elementLayout.getSpan(t,e+r),++o}return r}decode(t,e=0){const r=[];let n=0,o=this.count;for(o instanceof E&&(o=o.decode(t,e));n<o;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e,r=0){const n=this.elementLayout,o=t.reduce(((t,o)=>t+n.encode(o,e,r+t)),0);return this.count instanceof E&&this.count.encode(t.length,e,r),o}}y.Sequence=V;class z extends m{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof m),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===r&&(r=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const o=n.getSpan(t,e);return e+=o,r+o}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){w(t);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const n=r;let o=0,i=0;for(const n of this.fields){let s=n.span;if(i=0<s?s:0,void 0!==n.property){const o=t[n.property];void 0!==o&&(i=n.encode(o,e,r),0>s&&(s=n.getSpan(e,r)))}o=r,r+=s}return o+i-n}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}y.Structure=z;class W{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}y.UnionDiscriminator=W;class j extends W{constructor(t,e){if(!(t instanceof E&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}y.UnionLayoutDiscriminator=j;class F extends m{constructor(t,e,r){let n;if(t instanceof I||t instanceof S)n=new j(new A(t));else if(t instanceof E&&t.isCount())n=new j(t);else{if(!(t instanceof W))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=t}if(void 0===e&&(e=null),!(null===e||e instanceof m))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&(t instanceof I||t instanceof S)&&(o+=n.layout.span)),super(o,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof I||t instanceof S,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return i(t)},this.configGetSourceVariant=function(t){i=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r;const n=this.discriminator,o=n.decode(t,e),i=this.registry[o];if(void 0===i){const i=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=o,r[i.property]=i.decode(t,e+s)}else r=i.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=n.layout.span),n.encode(t[n.property],e,r),i+o.encode(t[o.property],e,r+i)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new K(this,t,e,r);return this.registry[t]=n,n}getVariant(t,e=0){let r;return r=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[r]}}y.Union=F;class K extends m{constructor(t,e,r,n){if(!(t instanceof F))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof m))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof n)throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=r?r.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,n),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=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(t,e+r)),r+n}decode(t,e=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let o=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),o+=this.layout.getSpan(e,r+n),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function H(t){return 0>t&&(t+=4294967296),t}y.VariantLayout=K;class G extends m{constructor(t,e,r){if(!(t instanceof I||t instanceof S))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let n=0;this._packedSetValue=function(t){return n=H(t),this},this._packedGetValue=function(){return n}}decode(t,e=0){const r=this.makeDestinationObject(),n=this.word.decode(t,e);this._packedSetValue(n);for(const e of this.fields)void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){const n=this.word.decode(e,r);this._packedSetValue(n);for(const e of this.fields)if(void 0!==e.property){const r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){const r=new q(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new Y(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}y.BitStructure=G;class q{constructor(t,e,r){if(!(t instanceof G))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const n=8*t.span,o=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+o>n)throw new Error("bits too long for span remainder ("+(n-o)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=n-o-e),this.wordMask=H(this.valueMask<<this.start),this.property=r}decode(t,e){return H(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==H(t&this.valueMask))throw new TypeError(v("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=H(t<<this.start);this.container._packedSetValue(H(e&~this.wordMask)|r)}}y.BitField=q;class Y extends q{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t=+t),super.encode(t)}}y.Boolean=Y;class $ extends m{constructor(t,e){if(!(t instanceof E&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof E||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),b(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof E&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(v("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const o=b(t);return b(e).write(o.toString("hex"),r,n,"hex"),this.length instanceof E&&this.length.encode(n,e,r),n}}y.Blob=$;class Z extends m{constructor(t){super(-1,t)}getSpan(t,e=0){w(t);let r=e;for(;r<t.length&&0!==t[r];)r+=1;return 1+r-e}decode(t,e=0){const r=this.getSpan(t,e);return b(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(r+o>e.length)throw new RangeError("encoding overruns Buffer");const i=b(e);return n.copy(i,r),i[r+o]=0,o+1}}y.CString=Z;class X extends m{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return w(t),t.length-e}decode(t,e=0){const r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return b(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(r+o>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(b(e),r),o}}y.UTF8=X;class Q extends m{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}y.Constant=Q,y.greedy=(t,e)=>new x(t,e),y.offset=(t,e,r)=>new A(t,e,r);var J=y.u8=t=>new I(1,t);y.u16=t=>new I(2,t),y.u24=t=>new I(3,t);var tt=y.u32=t=>new I(4,t);y.u40=t=>new I(5,t),y.u48=t=>new I(6,t),y.nu64=t=>new _(t),y.u16be=t=>new S(2,t),y.u24be=t=>new S(3,t),y.u32be=t=>new S(4,t),y.u40be=t=>new S(5,t),y.u48be=t=>new S(6,t),y.nu64be=t=>new U(t),y.s8=t=>new B(1,t),y.s16=t=>new B(2,t),y.s24=t=>new B(3,t),y.s32=t=>new B(4,t),y.s40=t=>new B(5,t),y.s48=t=>new B(6,t),y.ns64=t=>new L(t),y.s16be=t=>new R(2,t),y.s24be=t=>new R(3,t),y.s32be=t=>new R(4,t),y.s40be=t=>new R(5,t),y.s48be=t=>new R(6,t),y.ns64be=t=>new C(t),y.f32=t=>new O(t),y.f32be=t=>new N(t),y.f64=t=>new D(t),y.f64be=t=>new M(t);var et=y.struct=(t,e,r)=>new z(t,e,r);y.bits=(t,e,r)=>new G(t,e,r),y.seq=(t,e,r)=>new V(t,e,r),y.union=(t,e,r)=>new F(t,e,r),y.unionLayoutDiscriminator=(t,e)=>new j(t,e);var rt=y.blob=(t,e)=>new $(t,e);y.cstr=t=>new Z(t),y.utf8=(t,e)=>new X(t,e),y.constant=(t,e)=>new Q(t,e);const nt=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var ot={};Object.defineProperty(ot,"__esModule",{value:!0});var it=ot.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};ot.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var st=ot.toBufferLE=function(t,e){{const r=t.toString(16),n=Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};ot.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const at=(ct=8,t=>{const e=rt(ct,t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>{const r=n(t,e);return it(Buffer.from(r))},o.encode=(t,e,n)=>{const o=st(t,ct);return r(o,e,n)},o});var ct;const ut=t=>{const e=J(t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>!!n(t,e),o.encode=(t,e,n)=>{const o=Number(t);return r(o,e,n)},o},ft=e=>{const r=rt(32,e),{encode:n,decode:o}=nt(r),i=r;return i.decode=(e,r)=>{const n=o(e,r);return new t.PublicKey(n)},i.encode=(t,e,r)=>{const o=t.toBuffer();return n(o,e,r)},i};class ht extends Error{constructor(t){super(t)}}class dt extends ht{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class pt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class lt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class yt extends ht{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class gt extends ht{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var wt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(wt||(wt={}));const bt=1,mt=et([J("m"),J("n"),ut("isInitialized"),ft("signer1"),ft("signer2"),ft("signer3"),ft("signer4"),ft("signer5"),ft("signer6"),ft("signer7"),ft("signer8"),ft("signer9"),ft("signer10"),ft("signer11")]).span;var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(vt||(vt={}));const Et=et([ft("mint"),ft("owner"),at("amount"),tt("delegateOption"),ft("delegate"),J("state"),tt("isNativeOption"),at("isNative"),at("delegatedAmount"),tt("closeAuthorityOption"),ft("closeAuthority")]),xt=Et.span,At=et([tt("mintAuthorityOption"),ft("mintAuthority"),at("supply"),J("decimals"),ut("isInitialized"),tt("freezeAuthorityOption"),ft("freezeAuthority")]),It=At.span;async function St(t,e,r,n=p){return function(t,e,r=p){if(!e)throw new dt;if(!e.owner.equals(r))throw new pt;if(e.data.length<It)throw new lt;const n=At.decode(e.data.slice(0,It));let o=Buffer.alloc(0);if(e.data.length>It){if(e.data.length<=xt)throw new lt;if(e.data.length===mt)throw new lt;if(e.data[xt]!=wt.Mint)throw new yt;o=e.data.slice(xt+bt)}return{address:t,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:o}}(e,await t.getAccountInfo(e,r),n)}function Bt(e,r,n=!1,o=p,i=l){if(!n&&!t.PublicKey.isOnCurve(r.toBuffer()))throw new gt;const[s]=t.PublicKey.findProgramAddressSync([r.toBuffer(),o.toBuffer(),e.toBuffer()],i);return s}function Rt(e,r,n,o,i=p,s=l){return function(e,r,n,o,i,s=p,a=l){const c=[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:c,programId:a,data:i})}(e,r,n,o,Buffer.from([1]),i,s)}var Pt;exports.ErrorType=void 0,(Pt=exports.ErrorType||(exports.ErrorType={})).SymbolNotFound="SymbolNotFound",Pt.InvalidSubdomain="InvalidSubdomain",Pt.FavouriteDomainNotFound="FavouriteDomainNotFound",Pt.MissingParentOwner="MissingParentOwner",Pt.U32Overflow="U32Overflow",Pt.InvalidBufferLength="InvalidBufferLength",Pt.U64Overflow="U64Overflow",Pt.NoRecordData="NoRecordData",Pt.InvalidRecordData="InvalidRecordData",Pt.UnsupportedRecord="UnsupportedRecord",Pt.InvalidEvmAddress="InvalidEvmAddress",Pt.InvalidInjectiveAddress="InvalidInjectiveAddress",Pt.InvalidARecord="InvalidARecord",Pt.InvalidAAAARecord="InvalidAAAARecord",Pt.InvalidRecordInput="InvalidRecordInput",Pt.InvalidSignature="InvalidSignature",Pt.AccountDoesNotExist="AccountDoesNotExist",Pt.MultipleRegistries="MultipleRegistries",Pt.InvalidReverseTwitter="InvalidReverseTwitter",Pt.NoAccountData="NoAccountData",Pt.InvalidInput="InvalidInput",Pt.InvalidDomain="InvalidDomain",Pt.InvalidCustomBg="InvalidCustomBackground",Pt.UnsupportedSignature="UnsupportedSignature",Pt.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",Pt.RecordIsNotSigned="RecordIsNotSigned",Pt.UnsupportedSignatureType="UnsupportedSignatureType",Pt.InvalidSolRecordV2="InvalidSolRecordV2",Pt.MissingVerifier="MissingVerifier",Pt.PythFeedNotFound="PythFeedNotFound";class kt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,kt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new kt(exports.ErrorType.InvalidBufferLength,`Invalid buffer length: ${t.length}`);const e=BigInt(t.readUInt32LE(0));return new Tt(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}class _t{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new kt(exports.ErrorType.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new _t(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ut,Lt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ct=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),Ot=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),o=this.view[n](this.offset,!0);return this.offset+=r,o},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),Nt=(Ut=function(t,e){return Ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ut(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ut(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Dt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function Mt(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var Vt=Lt.concat(["bool","string"]),zt=["option","enum","array","set","map","struct"],Wt=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Nt(e,t),e}(Error);function jt(t){if("string"!=typeof t||!Vt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&zt.includes(e[0])){var r=e[0];if("option"===r)return jt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Wt(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');jt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return jt(t.type);throw new Wt(t,"{ type, len? }")}(t[r]);if("set"===r)return jt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Wt(t,"{ key, value }");jt(t.key),jt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"object");for(var e in t)jt(t[e])}(t[r])}}throw new Wt(t,zt.join(", ")+" or "+Vt.join(", "))}}var Ft=function(){function t(t){this.encoded=new Ct,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(Lt.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&Dt(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Dt(t,"string",this.fieldPath);var e=t;this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encoded.store_value(e.charCodeAt(r),"u8")},t.prototype.encode_boolean=function(t){this.checkTypes&&Dt(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?Mt(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?Mt(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&Dt(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Dt(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var o=0,i=n;o<i.length;o++){var s=i[o];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&Dt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),Kt=function(){function t(t){this.buffer=new Ot(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Lt.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},t.prototype.decode_string=function(){var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t));return String.fromCharCode.apply(null,e)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function Ht(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Ft(r).encode(e,t)}function Gt(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Kt(e).decode(t)}function qt(e,r,o,i,s,a,c,u,f,h,d){const p=[n.Buffer.from(Int8Array.from([0])),new Tt(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(p),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1}];return f?y.push({pubkey:f,isSigner:!0,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),h?y.push({pubkey:h,isSigner:!1,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d&&y.push({pubkey:d,isSigner:!0,isWritable:!1}),new t.TransactionInstruction({keys:y,programId:e,data:l})}function Yt(e,r,o,i,s){const a=[n.Buffer.from(Int8Array.from([1])),o.toBuffer(),new Tt(i.length).toBuffer(),i],c=n.Buffer.concat(a),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new t.TransactionInstruction({keys:u,programId:e,data:c})}function $t(e,r,o,i,s,a,c){const u=[n.Buffer.from(Int8Array.from([2])),o.toBuffer()],f=n.Buffer.concat(u),h=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c||i,isSigner:!0,isWritable:!1}];return s&&h.push({pubkey:s,isSigner:!0,isWritable:!1}),c&&a&&(s||h.push({pubkey:t.PublicKey.default,isSigner:!1,isWritable:!1}),h.push({pubkey:a,isSigner:!1,isWritable:!1})),new t.TransactionInstruction({keys:h,programId:e,data:f})}function Zt(e,r,o,i){const s=[n.Buffer.from(Int8Array.from([3]))],a=n.Buffer.concat(s),c=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!0}];return new t.TransactionInstruction({keys:c,programId:e,data:a})}class Xt{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Ht(Xt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d){const l=n.Buffer.from(this.serialize()),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!0,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:y,programId:e,data:l})}}Xt.schema={struct:{tag:"u8",name:"string",space:"u32"}};class Qt{constructor(t){this.tag=12,this.name=t.name}serialize(){return Ht(Qt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!1}),p.push({pubkey:a,isSigner:!1,isWritable:!1}),p.push({pubkey:c,isSigner:!0,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&p.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&p.push({pubkey:h,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}Qt.schema={struct:{tag:"u8",name:"string"}};class Jt{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Ht(Jt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!1}),v.push({pubkey:d,isSigner:!1,isWritable:!1}),v.push({pubkey:p,isSigner:!1,isWritable:!1}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),b&&v.push({pubkey:b,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:v,programId:e,data:m})}}Jt.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class te{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Ht(te.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:p,isSigner:!1,isWritable:!0}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),v.push({pubkey:b,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:v,programId:e,data:m})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(){this.tag=16}serialize(){return Ht(ee.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!0}),p.push({pubkey:a,isSigner:!1,isWritable:!0}),p.push({pubkey:c,isSigner:!1,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),p.push({pubkey:f,isSigner:!0,isWritable:!1}),p.push({pubkey:h,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}ee.schema={struct:{tag:"u8"}};const re=new t.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ne=n.Buffer.from("tokenized_name"),oe=e=>{const[r]=t.PublicKey.findProgramAddressSync([ne,e.toBuffer()],re);return r};var ie;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(ie||(ie={}));class se{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t.PublicKey(e.nameAccount),this.owner=new t.PublicKey(e.owner),this.nftMint=new t.PublicKey(e.nftMint)}static deserialize(t){return new se(Gt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("NFT record not found");return this.deserialize(r.data)}static async findKey(e,r){return await t.PublicKey.findProgramAddress([n.Buffer.from("nft_record"),e.toBuffer()],r)}}se.schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};const ae=async(e,r)=>{try{const[n]=await t.PublicKey.findProgramAddress([ne,r.toBuffer()],re);if("0"===(await St(e,n)).supply.toString())return;const o=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],i=await e.getProgramAccounts(p,{filters:o});if(1!=i.length)return;return new t.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ce=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ue=async(t,e)=>{const r=await(async(t,e)=>{const r=[{memcmp:{offset:0,bytes:"3"}},{memcmp:{offset:66,bytes:e.toBase58()}}];return await t.getProgramAccounts(re,{filters:r})})(t,e.mint);if(1===r.length)return se.deserialize(r[0].account.data)},fe=async(t,e)=>{const r=[...ce(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(p,{filters:r})).map((t=>Et.decode(t.account.data))).map((e=>ue(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class he{constructor(e){this.parentName=new t.PublicKey(e.parentName),this.owner=new t.PublicKey(e.owner),this.class=new t.PublicKey(e.class)}static deserialize(t){const e=new he(Gt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e}static async retrieve(t,e){var r;const n=await t.getAccountInfo(e);if(!n)throw new kt(exports.ErrorType.AccountDoesNotExist);const o=new he(Gt(this.schema,n.data));o.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:o,nftOwner:await ae(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new he(Gt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e};return r.map((t=>n(null==t?void 0:t.data)))}static async retrieveBatch(t,e){let r=[];const n=[...e];for(;n.length>0;)r.push(...await this._retrieveBatch(t,n.splice(0,100)));return r}}function de(t,...e){if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function pe(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}he.HEADER_LEN=96,he.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const le="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
10
+ !function(t){const e=o,r=d,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function s(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=s(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if($(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);const o=function(t){if(a.isBuffer(t)){const e=0|l(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?s(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return u(t),s(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,a.prototype),n}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(o)return n?-1:G(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){let i,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(t,i+n)!==u(e,n)){r=!1;break}if(r)return i}return-1}function v(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(Z(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return Y(G(e,t.length-r),t,r,n)}function x(t,e,r,n){return Y(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return Y(q(e),t,r,n)}function I(t,e,r,n){return Y(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function S(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function B(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(i=c));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}t.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){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(t,e,r){return c(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return f(t)},a.allocUnsafeSlow=function(t){return f(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),$(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).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(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=a.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if($(e,Uint8Array))o+e.length>n.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)w(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,o){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const c=Math.min(i,s),u=this.slice(n,o),f=t.slice(e,r);for(let t=0;t<c;++t)if(u[t]!==f[t]){i=u[t],s=f[t];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=X[t[n]];return o}function _(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function O(t,e,r,n,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function N(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,n,o,i){return e=+e,n>>>=0,i||N(t,0,n,4),r.write(t,e,n,o,23,4),n+4}function M(t,e,n,o,i){return e=+e,n>>>=0,i||N(t,0,n,8),r.write(t,e,n,o,52,8),n+8}a.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),a.prototype.readBigUInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),a.prototype.readBigInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=a.isBuffer(t)?t:a.from(t,n),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%s]}return this};const V={};function z(t,e,r){V[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function j(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||K(e,t.length-(r+1))}(n,o,i)}function F(t,e){if("number"!=typeof t)throw new V.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=W(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(n);const p=new t.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const l=new t.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t.PublicKey("So11111111111111111111111111111111111111112"),new t.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.s16=y.s8=y.nu64be=y.u48be=y.u40be=y.u32be=y.u24be=y.u16be=y.nu64=y.u48=y.u40=tt=y.u32=y.u24=y.u16=J=y.u8=y.offset=y.greedy=y.Constant=y.UTF8=y.CString=y.Blob=y.Boolean=y.BitField=y.BitStructure=y.VariantLayout=y.Union=y.UnionLayoutDiscriminator=y.UnionDiscriminator=y.Structure=y.Sequence=y.DoubleBE=y.Double=y.FloatBE=y.Float=y.NearInt64BE=y.NearInt64=y.NearUInt64BE=y.NearUInt64=y.IntBE=y.Int=y.UIntBE=y.UInt=y.OffsetLayout=y.GreedyCount=y.ExternalLayout=y.bindConstructorLayout=y.nameWithProperty=y.Layout=y.uint8ArrayToBuffer=y.checkUint8Array=void 0,y.constant=y.utf8=y.cstr=rt=y.blob=y.unionLayoutDiscriminator=y.union=y.seq=y.bits=et=y.struct=y.f64be=y.f64=y.f32be=y.f32=y.ns64be=y.s48be=y.s40be=y.s32be=y.s24be=y.s16be=y.ns64=y.s48=y.s40=y.s32=y.s24=void 0;const g=n;function w(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function b(t){return w(t),g.Buffer.from(t.buffer,t.byteOffset,t.length)}y.checkUint8Array=w,y.uint8ArrayToBuffer=b;class m{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function v(t,e){return e.property?t+"["+e.property+"]":t}y.Layout=m,y.nameWithProperty=v,y.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof m))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,r)=>e.decode(t,r),writable:!0})};class E extends m{isCount(){throw new Error("ExternalLayout is abstract")}}y.ExternalLayout=E;class x extends E{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){w(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}y.GreedyCount=x;class A extends E{constructor(t,e=0,r){if(!(t instanceof m))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof I||this.layout instanceof S}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}y.OffsetLayout=A;class I extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntLE(t,r,this.span),this.span}}y.UInt=I;class S extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntBE(t,r,this.span),this.span}}y.UIntBE=S;class B extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeIntLE(t,r,this.span),this.span}}y.Int=B;class R extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeIntBE(t,r,this.span),this.span}}y.IntBE=R;const P=Math.pow(2,32);function k(t){const e=Math.floor(t/P);return{hi32:e,lo32:t-e*P}}function T(t,e){return t*P+e}class _ extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeUInt32LE(n.hi32,r+4),8}}y.NearUInt64=_;class U extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearUInt64BE=U;class L extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeInt32LE(n.hi32,r+4),8}}y.NearInt64=L;class C extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearInt64BE=C;class O extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatLE(e)}encode(t,e,r=0){return b(e).writeFloatLE(t,r),4}}y.Float=O;class N extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatBE(e)}encode(t,e,r=0){return b(e).writeFloatBE(t,r),4}}y.FloatBE=N;class D extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleLE(e)}encode(t,e,r=0){return b(e).writeDoubleLE(t,r),8}}y.Double=D;class M extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleBE(e)}encode(t,e,r=0){return b(e).writeDoubleBE(t,r),8}}y.DoubleBE=M;class V extends m{constructor(t,e,r){if(!(t instanceof m))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof E&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(e instanceof E)&&0<t.span&&(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof E&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let o=0;for(;o<n;)r+=this.elementLayout.getSpan(t,e+r),++o}return r}decode(t,e=0){const r=[];let n=0,o=this.count;for(o instanceof E&&(o=o.decode(t,e));n<o;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e,r=0){const n=this.elementLayout,o=t.reduce(((t,o)=>t+n.encode(o,e,r+t)),0);return this.count instanceof E&&this.count.encode(t.length,e,r),o}}y.Sequence=V;class z extends m{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof m),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===r&&(r=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const o=n.getSpan(t,e);return e+=o,r+o}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){w(t);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const n=r;let o=0,i=0;for(const n of this.fields){let s=n.span;if(i=0<s?s:0,void 0!==n.property){const o=t[n.property];void 0!==o&&(i=n.encode(o,e,r),0>s&&(s=n.getSpan(e,r)))}o=r,r+=s}return o+i-n}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}y.Structure=z;class W{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}y.UnionDiscriminator=W;class j extends W{constructor(t,e){if(!(t instanceof E&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}y.UnionLayoutDiscriminator=j;class F extends m{constructor(t,e,r){let n;if(t instanceof I||t instanceof S)n=new j(new A(t));else if(t instanceof E&&t.isCount())n=new j(t);else{if(!(t instanceof W))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=t}if(void 0===e&&(e=null),!(null===e||e instanceof m))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&(t instanceof I||t instanceof S)&&(o+=n.layout.span)),super(o,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof I||t instanceof S,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return i(t)},this.configGetSourceVariant=function(t){i=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r;const n=this.discriminator,o=n.decode(t,e),i=this.registry[o];if(void 0===i){const i=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=o,r[i.property]=i.decode(t,e+s)}else r=i.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=n.layout.span),n.encode(t[n.property],e,r),i+o.encode(t[o.property],e,r+i)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new K(this,t,e,r);return this.registry[t]=n,n}getVariant(t,e=0){let r;return r=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[r]}}y.Union=F;class K extends m{constructor(t,e,r,n){if(!(t instanceof F))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof m))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof n)throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=r?r.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,n),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=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(t,e+r)),r+n}decode(t,e=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let o=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),o+=this.layout.getSpan(e,r+n),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function H(t){return 0>t&&(t+=4294967296),t}y.VariantLayout=K;class G extends m{constructor(t,e,r){if(!(t instanceof I||t instanceof S))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let n=0;this._packedSetValue=function(t){return n=H(t),this},this._packedGetValue=function(){return n}}decode(t,e=0){const r=this.makeDestinationObject(),n=this.word.decode(t,e);this._packedSetValue(n);for(const e of this.fields)void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){const n=this.word.decode(e,r);this._packedSetValue(n);for(const e of this.fields)if(void 0!==e.property){const r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){const r=new q(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new Y(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}y.BitStructure=G;class q{constructor(t,e,r){if(!(t instanceof G))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const n=8*t.span,o=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+o>n)throw new Error("bits too long for span remainder ("+(n-o)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=n-o-e),this.wordMask=H(this.valueMask<<this.start),this.property=r}decode(t,e){return H(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==H(t&this.valueMask))throw new TypeError(v("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=H(t<<this.start);this.container._packedSetValue(H(e&~this.wordMask)|r)}}y.BitField=q;class Y extends q{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t=+t),super.encode(t)}}y.Boolean=Y;class $ extends m{constructor(t,e){if(!(t instanceof E&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof E||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),b(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof E&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(v("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const o=b(t);return b(e).write(o.toString("hex"),r,n,"hex"),this.length instanceof E&&this.length.encode(n,e,r),n}}y.Blob=$;class Z extends m{constructor(t){super(-1,t)}getSpan(t,e=0){w(t);let r=e;for(;r<t.length&&0!==t[r];)r+=1;return 1+r-e}decode(t,e=0){const r=this.getSpan(t,e);return b(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(r+o>e.length)throw new RangeError("encoding overruns Buffer");const i=b(e);return n.copy(i,r),i[r+o]=0,o+1}}y.CString=Z;class X extends m{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return w(t),t.length-e}decode(t,e=0){const r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return b(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(r+o>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(b(e),r),o}}y.UTF8=X;class Q extends m{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}y.Constant=Q,y.greedy=(t,e)=>new x(t,e),y.offset=(t,e,r)=>new A(t,e,r);var J=y.u8=t=>new I(1,t);y.u16=t=>new I(2,t),y.u24=t=>new I(3,t);var tt=y.u32=t=>new I(4,t);y.u40=t=>new I(5,t),y.u48=t=>new I(6,t),y.nu64=t=>new _(t),y.u16be=t=>new S(2,t),y.u24be=t=>new S(3,t),y.u32be=t=>new S(4,t),y.u40be=t=>new S(5,t),y.u48be=t=>new S(6,t),y.nu64be=t=>new U(t),y.s8=t=>new B(1,t),y.s16=t=>new B(2,t),y.s24=t=>new B(3,t),y.s32=t=>new B(4,t),y.s40=t=>new B(5,t),y.s48=t=>new B(6,t),y.ns64=t=>new L(t),y.s16be=t=>new R(2,t),y.s24be=t=>new R(3,t),y.s32be=t=>new R(4,t),y.s40be=t=>new R(5,t),y.s48be=t=>new R(6,t),y.ns64be=t=>new C(t),y.f32=t=>new O(t),y.f32be=t=>new N(t),y.f64=t=>new D(t),y.f64be=t=>new M(t);var et=y.struct=(t,e,r)=>new z(t,e,r);y.bits=(t,e,r)=>new G(t,e,r),y.seq=(t,e,r)=>new V(t,e,r),y.union=(t,e,r)=>new F(t,e,r),y.unionLayoutDiscriminator=(t,e)=>new j(t,e);var rt=y.blob=(t,e)=>new $(t,e);y.cstr=t=>new Z(t),y.utf8=(t,e)=>new X(t,e),y.constant=(t,e)=>new Q(t,e);const nt=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var ot={};Object.defineProperty(ot,"__esModule",{value:!0});var it=ot.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};ot.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var st=ot.toBufferLE=function(t,e){{const r=t.toString(16),n=Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};ot.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const at=(ct=8,t=>{const e=rt(ct,t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>{const r=n(t,e);return it(Buffer.from(r))},o.encode=(t,e,n)=>{const o=st(t,ct);return r(o,e,n)},o});var ct;const ut=t=>{const e=J(t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>!!n(t,e),o.encode=(t,e,n)=>{const o=Number(t);return r(o,e,n)},o},ft=e=>{const r=rt(32,e),{encode:n,decode:o}=nt(r),i=r;return i.decode=(e,r)=>{const n=o(e,r);return new t.PublicKey(n)},i.encode=(t,e,r)=>{const o=t.toBuffer();return n(o,e,r)},i};class ht extends Error{constructor(t){super(t)}}class dt extends ht{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class pt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class lt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class yt extends ht{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class gt extends ht{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var wt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(wt||(wt={}));const bt=1,mt=et([J("m"),J("n"),ut("isInitialized"),ft("signer1"),ft("signer2"),ft("signer3"),ft("signer4"),ft("signer5"),ft("signer6"),ft("signer7"),ft("signer8"),ft("signer9"),ft("signer10"),ft("signer11")]).span;var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(vt||(vt={}));const Et=et([ft("mint"),ft("owner"),at("amount"),tt("delegateOption"),ft("delegate"),J("state"),tt("isNativeOption"),at("isNative"),at("delegatedAmount"),tt("closeAuthorityOption"),ft("closeAuthority")]),xt=Et.span,At=et([tt("mintAuthorityOption"),ft("mintAuthority"),at("supply"),J("decimals"),ut("isInitialized"),tt("freezeAuthorityOption"),ft("freezeAuthority")]),It=At.span;async function St(t,e,r,n=p){return function(t,e,r=p){if(!e)throw new dt;if(!e.owner.equals(r))throw new pt;if(e.data.length<It)throw new lt;const n=At.decode(e.data.slice(0,It));let o=Buffer.alloc(0);if(e.data.length>It){if(e.data.length<=xt)throw new lt;if(e.data.length===mt)throw new lt;if(e.data[xt]!=wt.Mint)throw new yt;o=e.data.slice(xt+bt)}return{address:t,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:o}}(e,await t.getAccountInfo(e,r),n)}function Bt(e,r,n=!1,o=p,i=l){if(!n&&!t.PublicKey.isOnCurve(r.toBuffer()))throw new gt;const[s]=t.PublicKey.findProgramAddressSync([r.toBuffer(),o.toBuffer(),e.toBuffer()],i);return s}function Rt(e,r,n,o,i=p,s=l){return function(e,r,n,o,i,s=p,a=l){const c=[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:c,programId:a,data:i})}(e,r,n,o,Buffer.from([1]),i,s)}var Pt;exports.ErrorType=void 0,(Pt=exports.ErrorType||(exports.ErrorType={})).SymbolNotFound="SymbolNotFound",Pt.InvalidSubdomain="InvalidSubdomain",Pt.FavouriteDomainNotFound="FavouriteDomainNotFound",Pt.MissingParentOwner="MissingParentOwner",Pt.U32Overflow="U32Overflow",Pt.InvalidBufferLength="InvalidBufferLength",Pt.U64Overflow="U64Overflow",Pt.NoRecordData="NoRecordData",Pt.InvalidRecordData="InvalidRecordData",Pt.UnsupportedRecord="UnsupportedRecord",Pt.InvalidEvmAddress="InvalidEvmAddress",Pt.InvalidInjectiveAddress="InvalidInjectiveAddress",Pt.InvalidARecord="InvalidARecord",Pt.InvalidAAAARecord="InvalidAAAARecord",Pt.InvalidRecordInput="InvalidRecordInput",Pt.InvalidSignature="InvalidSignature",Pt.AccountDoesNotExist="AccountDoesNotExist",Pt.MultipleRegistries="MultipleRegistries",Pt.InvalidReverseTwitter="InvalidReverseTwitter",Pt.NoAccountData="NoAccountData",Pt.InvalidInput="InvalidInput",Pt.InvalidDomain="InvalidDomain",Pt.InvalidCustomBg="InvalidCustomBackground",Pt.UnsupportedSignature="UnsupportedSignature",Pt.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",Pt.RecordIsNotSigned="RecordIsNotSigned",Pt.UnsupportedSignatureType="UnsupportedSignatureType",Pt.InvalidSolRecordV2="InvalidSolRecordV2",Pt.MissingVerifier="MissingVerifier",Pt.PythFeedNotFound="PythFeedNotFound";class kt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,kt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new kt(exports.ErrorType.InvalidBufferLength,`Invalid buffer length: ${t.length}`);const e=BigInt(t.readUInt32LE(0));return new Tt(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}class _t{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new kt(exports.ErrorType.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new _t(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ut,Lt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ct=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),Ot=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),o=this.view[n](this.offset,!0);return this.offset+=r,o},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),Nt=(Ut=function(t,e){return Ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ut(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ut(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Dt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function Mt(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var Vt=Lt.concat(["bool","string"]),zt=["option","enum","array","set","map","struct"],Wt=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Nt(e,t),e}(Error);function jt(t){if("string"!=typeof t||!Vt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&zt.includes(e[0])){var r=e[0];if("option"===r)return jt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Wt(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');jt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return jt(t.type);throw new Wt(t,"{ type, len? }")}(t[r]);if("set"===r)return jt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Wt(t,"{ key, value }");jt(t.key),jt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"object");for(var e in t)jt(t[e])}(t[r])}}throw new Wt(t,zt.join(", ")+" or "+Vt.join(", "))}}var Ft=function(){function t(t){this.encoded=new Ct,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(Lt.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&Dt(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Dt(t,"string",this.fieldPath);for(var e=t,r=[],n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r.push(o):o<2048?r.push(192|o>>6,128|63&o):o<55296||o>=57344?r.push(224|o>>12,128|o>>6&63,128|63&o):(n++,o=65536+((1023&o)<<10|1023&e.charCodeAt(n)),r.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o))}this.encoded.store_value(r.length,"u32"),this.encoded.store_bytes(new Uint8Array(r))},t.prototype.encode_boolean=function(t){this.checkTypes&&Dt(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?Mt(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?Mt(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&Dt(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Dt(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var o=0,i=n;o<i.length;o++){var s=i[o];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&Dt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),Kt=function(){function t(t){this.buffer=new Ot(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Lt.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},t.prototype.decode_string=function(){for(var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t)),r=[],n=0;n<t;++n){var o=e[n];if(o<128)r.push(o);else if(o<224)r.push((31&o)<<6|63&e[++n]);else if(o<240)r.push((15&o)<<12|(63&e[++n])<<6|63&e[++n]);else{var i=(7&o)<<18|(63&e[++n])<<12|(63&e[++n])<<6|63&e[++n];r.push(i)}}return String.fromCodePoint.apply(String,r)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function Ht(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Ft(r).encode(e,t)}function Gt(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Kt(e).decode(t)}function qt(e,r,o,i,s,a,c,u,f,h,d){const p=[n.Buffer.from(Int8Array.from([0])),new Tt(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(p),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1}];return f?y.push({pubkey:f,isSigner:!0,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),h?y.push({pubkey:h,isSigner:!1,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d&&y.push({pubkey:d,isSigner:!0,isWritable:!1}),new t.TransactionInstruction({keys:y,programId:e,data:l})}function Yt(e,r,o,i,s){const a=[n.Buffer.from(Int8Array.from([1])),o.toBuffer(),new Tt(i.length).toBuffer(),i],c=n.Buffer.concat(a),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new t.TransactionInstruction({keys:u,programId:e,data:c})}function $t(e,r,o,i,s,a,c){const u=[n.Buffer.from(Int8Array.from([2])),o.toBuffer()],f=n.Buffer.concat(u),h=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c||i,isSigner:!0,isWritable:!1}];return s&&h.push({pubkey:s,isSigner:!0,isWritable:!1}),c&&a&&(s||h.push({pubkey:t.PublicKey.default,isSigner:!1,isWritable:!1}),h.push({pubkey:a,isSigner:!1,isWritable:!1})),new t.TransactionInstruction({keys:h,programId:e,data:f})}function Zt(e,r,o,i){const s=[n.Buffer.from(Int8Array.from([3]))],a=n.Buffer.concat(s),c=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!0}];return new t.TransactionInstruction({keys:c,programId:e,data:a})}class Xt{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Ht(Xt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d){const l=n.Buffer.from(this.serialize()),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!0,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:y,programId:e,data:l})}}Xt.schema={struct:{tag:"u8",name:"string",space:"u32"}};class Qt{constructor(t){this.tag=12,this.name=t.name}serialize(){return Ht(Qt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!1}),p.push({pubkey:a,isSigner:!1,isWritable:!1}),p.push({pubkey:c,isSigner:!0,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&p.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&p.push({pubkey:h,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}Qt.schema={struct:{tag:"u8",name:"string"}};class Jt{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Ht(Jt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!1}),v.push({pubkey:d,isSigner:!1,isWritable:!1}),v.push({pubkey:p,isSigner:!1,isWritable:!1}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),b&&v.push({pubkey:b,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:v,programId:e,data:m})}}Jt.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class te{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Ht(te.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:p,isSigner:!1,isWritable:!0}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),v.push({pubkey:b,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:v,programId:e,data:m})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(){this.tag=16}serialize(){return Ht(ee.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!0}),p.push({pubkey:a,isSigner:!1,isWritable:!0}),p.push({pubkey:c,isSigner:!1,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),p.push({pubkey:f,isSigner:!0,isWritable:!1}),p.push({pubkey:h,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}ee.schema={struct:{tag:"u8"}};const re=new t.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ne=n.Buffer.from("tokenized_name"),oe=e=>{const[r]=t.PublicKey.findProgramAddressSync([ne,e.toBuffer()],re);return r};var ie;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(ie||(ie={}));class se{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t.PublicKey(e.nameAccount),this.owner=new t.PublicKey(e.owner),this.nftMint=new t.PublicKey(e.nftMint)}static deserialize(t){return new se(Gt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("NFT record not found");return this.deserialize(r.data)}static async findKey(e,r){return await t.PublicKey.findProgramAddress([n.Buffer.from("nft_record"),e.toBuffer()],r)}}se.schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};const ae=async(e,r)=>{try{const[n]=await t.PublicKey.findProgramAddress([ne,r.toBuffer()],re);if("0"===(await St(e,n)).supply.toString())return;const o=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],i=await e.getProgramAccounts(p,{filters:o});if(1!=i.length)return;return new t.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ce=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ue=async(t,e)=>{const r=await(async(t,e)=>{const r=[{memcmp:{offset:0,bytes:"3"}},{memcmp:{offset:66,bytes:e.toBase58()}}];return await t.getProgramAccounts(re,{filters:r})})(t,e.mint);if(1===r.length)return se.deserialize(r[0].account.data)},fe=async(t,e)=>{const r=[...ce(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(p,{filters:r})).map((t=>Et.decode(t.account.data))).map((e=>ue(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class he{constructor(e){this.parentName=new t.PublicKey(e.parentName),this.owner=new t.PublicKey(e.owner),this.class=new t.PublicKey(e.class)}static deserialize(t){const e=new he(Gt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e}static async retrieve(t,e){var r;const n=await t.getAccountInfo(e);if(!n)throw new kt(exports.ErrorType.AccountDoesNotExist);const o=new he(Gt(this.schema,n.data));o.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:o,nftOwner:await ae(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new he(Gt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e};return r.map((t=>n(null==t?void 0:t.data)))}static async retrieveBatch(t,e){let r=[];const n=[...e];for(;n.length>0;)r.push(...await this._retrieveBatch(t,n.splice(0,100)));return r}}function de(t,...e){if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function pe(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}he.HEADER_LEN=96,he.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const le="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
11
11
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ye(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const ge=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),we=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function be(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function me(t){if("string"==typeof t&&(t=be(t)),!ye(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class ve{clone(){return this._cloneInto()}}function Ee(t){const e=e=>t().update(me(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class xe extends ve{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ge(this.buffer)}update(t){pe(this);const{view:e,buffer:r,blockLen:n}=this,o=(t=me(t)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=ge(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){pe(this),function(t,e){de(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let t=i;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=ge(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)s.setUint32(4*t,u[t],o)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return t.length=n,t.pos=s,t.finished=o,t.destroyed=i,n%e&&t.buffer.set(r),t}}const Ae=(t,e,r)=>t&e^~t&r,Ie=(t,e,r)=>t&e^t&r^e&r,Se=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Be=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Re=new Uint32Array(64);class Pe extends xe{constructor(){super(64,32,8,!1),this.A=0|Be[0],this.B=0|Be[1],this.C=0|Be[2],this.D=0|Be[3],this.E=0|Be[4],this.F=0|Be[5],this.G=0|Be[6],this.H=0|Be[7]}get(){const{A:t,B:e,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[t,e,r,n,o,i,s,a]}set(t,e,r,n,o,i,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Re[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Re[t-15],r=Re[t-2],n=we(e,7)^we(e,18)^e>>>3,o=we(r,17)^we(r,19)^r>>>10;Re[t]=o+Re[t-7]+n+Re[t-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let t=0;t<64;t++){const e=u+(we(s,6)^we(s,11)^we(s,25))+Ae(s,a,c)+Se[t]+Re[t]|0,f=(we(r,2)^we(r,13)^we(r,22))+Ie(r,n,o)|0;u=c,c=a,a=s,s=i+e|0,i=o,o=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,o,i,s,a,c,u)}roundClean(){Re.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ke=Ee((()=>new Pe)),Te=new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),_e="SPL Name Service",Ue=new t.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Le=new t.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ce=new t.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Oe=new t.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Ne=new t.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),De=new t.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Me=new t.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ve=new t.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),ze=new t.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),We=[new t.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t.PublicKey("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new t.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM")],je=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Fe=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",{price:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",product:"8GWTTbNiXdmyZREXbjsZBmCRuzdPrW55dnZGDkTRjWvb"}],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",{price:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",product:"Av6XyAMJnyi68FdsKSPYgzfXGjYrrt6jcAMwtvzLCqaM"}],["So11111111111111111111111111111111111111112",{price:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",product:"ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",product:"HyEB4Goiv7QyfFStaBn49JqQzSTV1ybtVikwsMLH1f2M"}],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",{price:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",product:"BS2iAqT67j8hA9Jji4B8UpL3Nfw9kwPfU5s4qeaf1e7r"}],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",{price:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",product:"FerFD54J6RgmQVCR5oNgpzXmz8BW2eBNhhirb1d5oifo"}],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",{price:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",product:"8xTEctXKo6Xo3EzNhSNp4TUe8mgfwWFbDUXJhuubvrKx"}],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",{price:"nrYkQQQur7z8rYTST3G9GqATviK5SxTDkrqd21MW6Ue",product:"AiQB4WngNPKDe3iWAwZmMzbULDAAfUD6Sr1knfZNJj3y"}],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",{price:"AFrYBhb5wKQtxRS9UA9YRS4V3dwFm7SqmS6DHKq6YVgo",product:"3RtUHQR2LQ7su5R4zWwjupx72sWRGvLA4cFmnbHnT9M7"}],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",{price:"9EdtbaivHQYA4Nh3XzGR6DwRaoorqXYnmpfsnFhvwuVj",product:"5Q5kyCVzssrGMd2BniSdVeRwjNWrGGrFhMrgGt4zURyA"}]]),Ke=new t.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),He=new t.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Ge=new t.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),qe=new t.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),Ye=new t.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function $e(t,e){if(!await t.getAccountInfo(e))throw new kt(exports.ErrorType.AccountDoesNotExist);return he.retrieve(t,e)}async function Ze(t){const e=_e+t,r=ke(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)}async function Xe(e,r,o){const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=await t.PublicKey.findProgramAddress(i,Te);return s}const Qe=async(t,e=Ue)=>{let r=await Ze(t);return{pubkey:await Xe(r,void 0,e),hashed:r}},Je=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=n.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:o}=await Qe(r[1]);return{...await Qe(t,o),isSub:!0,parent:o}}if(3===r.length&&e){const{pubkey:t}=await Qe(r[2]),{pubkey:e}=await Qe("\0".concat(r[1]),t),o=n.Buffer.from([1]).toString();return{...await Qe(o.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...await Qe(t,Ue),isSub:!1,parent:void 0}};var tr,er=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],rr=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),nr=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),o=this.view[n](this.offset,!0);return this.offset+=r,o},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),or=(tr=function(t,e){return tr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},tr(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}tr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function ir(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function sr(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var ar=er.concat(["bool","string"]),cr=["option","enum","array","set","map","struct"],ur=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return or(e,t),e}(Error);function fr(t){if("string"!=typeof t||!ar.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&cr.includes(e[0])){var r=e[0];if("option"===r)return fr(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new ur(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');fr({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new ur(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return fr(t.type);throw new ur(t,"{ type, len? }")}(t[r]);if("set"===r)return fr(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new ur(t,"{ key, value }");fr(t.key),fr(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new ur(t,"object");for(var e in t)fr(t[e])}(t[r])}}throw new ur(t,cr.join(", ")+" or "+ar.join(", "))}}var hr=function(){function t(t){this.encoded=new rr,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(er.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&ir(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&ir(t,"string",this.fieldPath);var e=t;this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encoded.store_value(e.charCodeAt(r),"u8")},t.prototype.encode_boolean=function(t){this.checkTypes&&ir(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?sr(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?sr(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&ir(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&ir(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var o=0,i=n;o<i.length;o++){var s=i[o];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&ir(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),dr=function(){function t(t){this.buffer=new nr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(er.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},t.prototype.decode_string=function(){var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t));return String.fromCharCode.apply(null,e)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function pr(t,e,r){return void 0===r&&(r=!0),r&&fr(t),new hr(r).encode(e,t)}class lr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return pr(lr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}lr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class yr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return pr(yr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}yr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class gr{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return pr(gr.schema,this)}getInstruction(e,r,n,o,i,s,a,c,u){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:o,isSigner:!0,isWritable:!0}),h.push({pubkey:i,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:c,isSigner:!1,isWritable:!1}),h.push({pubkey:u,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:h,programId:e,data:f})}}gr.schema={struct:{tag:"u8",staleness:"bool"}};class wr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return pr(wr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}wr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class br{constructor(){this.tag=5}serialize(){return pr(br.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}br.schema={struct:{tag:"u8"}};class mr{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return pr(mr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}mr.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const vr=new t.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Er]=t.PublicKey.findProgramAddressSync([vr.toBuffer()],vr);var xr,Ar;(Ar=xr||(xr={}))[Ar.None=0]="None",Ar[Ar.Solana=1]="Solana",Ar[Ar.Ethereum=2]="Ethereum",Ar[Ar.UnverifiedSolana=3]="UnverifiedSolana";const Ir=t=>{switch(t){case xr.None:return 0;case xr.Ethereum:return 20;case xr.Solana:case xr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Sr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Sr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&fr(e),new dr(r).decode(e)));var e,r,n}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data.slice(96,96+this.LEN))}}Sr.LEN=8,Sr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Br{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Sr.deserialize(t.slice(96,96+Sr.LEN)),r=t.slice(96+Sr.LEN);return new Br(e,r)}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data)}static async retrieveBatch(t,e){return(await t.getMultipleAccountsInfo(e)).map((t=>{if(null==t?void 0:t.data)return this.deserialize(t.data)}))}getContent(){let t=Ir(this.header.stalenessValidation)+Ir(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Ir(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Ir(this.header.stalenessValidation),e=t+Ir(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var Rr;exports.Record=void 0,(Rr=exports.Record||(exports.Record={})).IPFS="IPFS",Rr.ARWV="ARWV",Rr.SOL="SOL",Rr.ETH="ETH",Rr.BTC="BTC",Rr.LTC="LTC",Rr.DOGE="DOGE",Rr.Email="email",Rr.Url="url",Rr.Discord="discord",Rr.Github="github",Rr.Reddit="reddit",Rr.Twitter="twitter",Rr.Telegram="telegram",Rr.Pic="pic",Rr.SHDW="SHDW",Rr.POINT="POINT",Rr.BSC="BSC",Rr.Injective="INJ",Rr.Backpack="backpack",Rr.A="A",Rr.AAAA="AAAA",Rr.CNAME="CNAME",Rr.TXT="TXT",Rr.Background="background";const Pr=new Map([[exports.Record.SOL,96],[exports.Record.ETH,20],[exports.Record.BSC,20],[exports.Record.Injective,20],[exports.Record.A,4],[exports.Record.AAAA,16],[exports.Record.Background,32]]);var kr;exports.RecordVersion=void 0,(kr=exports.RecordVersion||(exports.RecordVersion={}))[kr.V1=1]="V1",kr[kr.V2=2]="V2";var Tr="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",_r="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Ur=0,Lr=-3;function Cr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Or(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Cr,this.dtree=new Cr}var Nr=new Cr,Dr=new Cr,Mr=new Uint8Array(30),Vr=new Uint16Array(30),zr=new Uint8Array(30),Wr=new Uint16Array(30),jr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fr=new Cr,Kr=new Uint8Array(320);function Hr(t,e,r,n){var o,i;for(o=0;o<r;++o)t[o]=0;for(o=0;o<30-r;++o)t[o+r]=o/r|0;for(i=n,o=0;o<30;++o)e[o]=i,i+=1<<t[o]}var Gr=new Uint16Array(16);function qr(t,e,r,n){var o,i;for(o=0;o<16;++o)t.table[o]=0;for(o=0;o<n;++o)t.table[e[r+o]]++;for(t.table[0]=0,i=0,o=0;o<16;++o)Gr[o]=i,i+=t.table[o];for(o=0;o<n;++o)e[r+o]&&(t.trans[Gr[e[r+o]]++]=o)}function Yr(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function $r(t,e,r){if(!e)return r;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var n=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,n+r}function Zr(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,o=0,i=t.tag;do{n=2*n+(1&i),i>>>=1,++o,r+=e.table[o],n-=e.table[o]}while(n>=0);return t.tag=i,t.bitcount-=o,e.trans[r+n]}function Xr(t,e,r){var n,o,i,s,a,c;for(n=$r(t,5,257),o=$r(t,5,1),i=$r(t,4,4),s=0;s<19;++s)Kr[s]=0;for(s=0;s<i;++s){var u=$r(t,3,0);Kr[jr[s]]=u}for(qr(Fr,Kr,0,19),a=0;a<n+o;){var f=Zr(t,Fr);switch(f){case 16:var h=Kr[a-1];for(c=$r(t,2,3);c;--c)Kr[a++]=h;break;case 17:for(c=$r(t,3,3);c;--c)Kr[a++]=0;break;case 18:for(c=$r(t,7,11);c;--c)Kr[a++]=0;break;default:Kr[a++]=f}}qr(e,Kr,0,n),qr(r,Kr,n,o)}function Qr(t,e,r){for(;;){var n,o,i,s,a=Zr(t,e);if(256===a)return Ur;if(a<256)t.dest[t.destLen++]=a;else for(n=$r(t,Mr[a-=257],Vr[a]),o=Zr(t,r),s=i=t.destLen-$r(t,zr[o],Wr[o]);s<i+n;++s)t.dest[t.destLen++]=t.dest[s]}}function Jr(t){for(var e,r;t.bitcount>8;)t.sourceIndex--,t.bitcount-=8;if((e=256*(e=t.source[t.sourceIndex+1])+t.source[t.sourceIndex])!==(65535&~(256*t.source[t.sourceIndex+3]+t.source[t.sourceIndex+2])))return Lr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Ur}!function(t,e){var r;for(r=0;r<7;++r)t.table[r]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,r=0;r<24;++r)t.trans[r]=256+r;for(r=0;r<144;++r)t.trans[24+r]=r;for(r=0;r<8;++r)t.trans[168+r]=280+r;for(r=0;r<112;++r)t.trans[176+r]=144+r;for(r=0;r<5;++r)e.table[r]=0;for(e.table[5]=32,r=0;r<32;++r)e.trans[r]=r}(Nr,Dr),Hr(Mr,Vr,4,3),Hr(zr,Wr,2,1),Mr[28]=0,Vr[28]=258;var tn=function(t,e){var r,n,o=new Or(t,e);do{switch(r=Yr(o),$r(o,2,0)){case 0:n=Jr(o);break;case 1:n=Qr(o,Nr,Dr);break;case 2:Xr(o,o.ltree,o.dtree),n=Qr(o,o.ltree,o.dtree);break;default:n=Lr}if(n!==Ur)throw new Error("Data error")}while(!r);return o.destLen<o.dest.length?"function"==typeof o.dest.slice?o.dest.slice(0,o.destLen):o.dest.subarray(0,o.destLen):o.dest};const en=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],rn=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var nn={swap32LE:t=>{en&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)rn(t,r,r+3),rn(t,r+1,r+2)})(t)}};const on=tn,{swap32LE:sn}=nn;var an=class{constructor(t){const e="function"==typeof t.readUInt32BE&&"function"==typeof t.slice;if(e||t instanceof Uint8Array){let r;if(e)this.highStart=t.readUInt32LE(0),this.errorValue=t.readUInt32LE(4),r=t.readUInt32LE(8),t=t.slice(12);else{const e=new DataView(t.buffer);this.highStart=e.getUint32(0,!0),this.errorValue=e.getUint32(4,!0),r=e.getUint32(8,!0),t=t.subarray(12)}t=on(t,new Uint8Array(r)),t=on(t,new Uint8Array(r)),sn(t),this.data=new Uint32Array(t.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=t)}get(t){let e;return t<0||t>1114111?this.errorValue:t<55296||t>56319&&t<=65535?(e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t<this.highStart?(e=this.data[2080+(t>>11)],e=this.data[e+(t>>5&63)],e=(e<<2)+(31&t),this.data[e]):this.data[this.data.length-4]}},cn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,cn.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof Buffer,i="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=Array.prototype.slice.call(a),u=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(c),f=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,h=String.fromCharCode.bind(String),d="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},l=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,o,i="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(o=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");i+=c[(e=r<<16|n<<8|o)>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}return s?i.slice(0,s-3)+"===".substring(s):i},g=n?function(t){return btoa(t)}:o?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=o?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,o=t.length;n<o;n+=e)r.push(h.apply(null,t.subarray(n,n+e)));return g(r.join(""))},b=function(t,e){return void 0===e&&(e=!1),e?p(w(t)):w(t)},m=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?h(192|e>>>6)+h(128|63&e):h(224|e>>>12&15)+h(128|e>>>6&63)+h(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return h(240|e>>>18&7)+h(128|e>>>12&63)+h(128|e>>>6&63)+h(128|63&e)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,E=function(t){return t.replace(v,m)},x=o?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},A=function(t,e){return void 0===e&&(e=!1),e?p(x(t)):x(t)},I=function(t){return A(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return h(55296+(e>>>10))+h(56320+(1023&e));case 3:return h((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return h((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},R=function(t){return t.replace(S,B)},P=function(t){if(t=t.replace(/\s+/g,""),!f.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,o="",i=0;i<t.length;)e=u[t.charAt(i++)]<<18|u[t.charAt(i++)]<<12|(r=u[t.charAt(i++)])<<6|(n=u[t.charAt(i++)]),o+=64===r?h(e>>16&255):64===n?h(e>>16&255,e>>8&255):h(e>>16&255,e>>8&255,255&e);return o},k=r?function(t){return atob(l(t))}:o?function(t){return Buffer.from(t,"base64").toString("binary")}:P,T=o?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(k(t).split("").map((function(t){return t.charCodeAt(0)})))},_=function(t){return T(L(t))},U=o?function(t){return Buffer.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(T(t))}:function(t){return R(k(t))},L=function(t){return l(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return U(L(t))},O=function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},N=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},D=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,N(e))};t("fromBase64",(function(){return C(this)})),t("toBase64",(function(t){return A(this,t)})),t("toBase64URI",(function(){return A(this,!0)})),t("toBase64URL",(function(){return A(this,!0)})),t("toUint8Array",(function(){return _(this)}))},M=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,N(e))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},V=function(){D(),M()},z={version:t,VERSION:e,atob:k,atobPolyfill:P,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:A,encode:A,encodeURI:I,encodeURL:I,utob:E,btou:R,decode:C,isValid:O,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:M,extendBuiltins:V,Base64:{}};return Object.keys(z).forEach((function(t){return z.Base64[t]=z[t]})),z}();const un={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},fn=Tr,hn=_r,dn=an,pn=cn.exports.Base64,ln=new dn(pn.toUint8Array(fn)),yn=new dn(pn.toUint8Array(hn));function gn(t,e){return 0!=(t&e)}const wn=0,bn=1,mn=2;function vn(t,e){const r=t.length;let n=0,o=wn;for(let i=e;i+1<r;i++){const r=t[i+0],s=t[i+1];switch(gn(r,un.Regional_Indicator)||(n=0),o){case mn:case wn:o=gn(r,un.Extended_Pictographic)?bn:wn;break;case bn:o=gn(r,un.Extend)?bn:gn(r,un.ZWJ)&&gn(s,un.Extended_Pictographic)?mn:wn}if(!gn(r,un.CR)||!gn(s,un.LF)){if(gn(r,un.Control|un.CR|un.LF))return i+1-e;if(gn(s,un.Control|un.CR|un.LF))return i+1-e;if(!(gn(r,un.L)&&gn(s,un.L|un.V|un.LV|un.LVT)||gn(r,un.LV|un.V)&&gn(s,un.V|un.T)||gn(r,un.LVT|un.T)&&gn(s,un.T)||gn(s,un.Extend|un.ZWJ)||gn(s,un.SpacingMark)||gn(r,un.Prepend)||o===mn)){if(!gn(r,un.Regional_Indicator)||!gn(s,un.Regional_Indicator)||n%2!=0)return i+1-e;n++}}}return r-e}var En=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const o=t.codePointAt(e);n.push(ln.get(o)|yn.get(o)),e+=o>65535?2:1,r.push(e)}for(let o=0;o<n.length;){const i=vn(n,o),s=r[o],a=r[o+i];e.push(t.slice(s,a)),o+=i}return e},xn=r(En);const An=t=>{const e=_e+t,r=ke(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)},In=(e,r,o)=>{const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=t.PublicKey.findProgramAddressSync(i,Te);return s};async function Sn(t,e){const r=An(e.toBase58()),n=In(r,Ne),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Ln(o.data)}async function Bn(t,e){let r=[];for(let t of e){const e=An(t.toBase58()),n=In(e,Ne);r.push(n)}return(await he.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Ln(t.data)}))}const Rn=(t,e=Ue,r)=>{let n=An(t);return{pubkey:In(n,r,e),hashed:n}},Pn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?Er:void 0,o=t.split(".");if(2===o.length){const t=n.Buffer.from([e||0]).toString().concat(o[0]),{pubkey:i}=Rn(o[1]);return{...Rn(t,i,r),isSub:!0,parent:i}}if(3===o.length&&e){const{pubkey:t}=Rn(o[2]),{pubkey:n}=Rn("\0".concat(o[1]),t),i=e===exports.RecordVersion.V2?"":"";return{...Rn(i.concat(o[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(o.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...Rn(t,Ue),isSub:!1,parent:void 0}};async function kn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:Ue.toBase58()}}];return(await t.getProgramAccounts(Te,{filters:r})).map((t=>t.pubkey))}const Tn=(t,e)=>{const{pubkey:r,parent:n}=Pn(t),o=An(r.toBase58());return In(o,Ne,e?n:void 0)},_n=(t,e)=>{const r=An(t.toBase58());return In(r,Ne,e)},Un=(t,e)=>{if(!t)throw new kt(e)};function Ln(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var Cn=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var o=t.charAt(n),i=o.charCodeAt(0);if(255!==e[i])throw new TypeError(o+" is ambiguous");e[i]=n}var s=t.length,a=t.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,o=0;t[r]===a;)n++,r++;for(var i=(t.length-r)*c+1>>>0,u=new Uint8Array(i);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=i-1;(0!==f||h<o)&&-1!==d;d--,h++)f+=s*u[d]>>>0,u[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,r++}for(var p=i-o;p!==i&&0===u[p];)p++;for(var l=new Uint8Array(n+(i-p)),y=n;p!==i;)l[y++]=u[p++];return l}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,o=0,i=e.length;o!==i&&0===e[o];)o++,r++;for(var c=(i-o)*u+1>>>0,f=new Uint8Array(c);o!==i;){for(var h=e[o],d=0,p=c-1;(0!==h||d<n)&&-1!==p;p--,d++)h+=256*f[p]>>>0,f[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,o++}for(var l=c-n;l!==c&&0===f[l];)l++;for(var y=a.repeat(r);l<c;++l)y+=t.charAt(f[l]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var On,Nn=Cn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Dn={exports:{}};On=Dn,function(t){const e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),i="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(i,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${i})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${i})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,o=0,i=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(i=t.indexOf(":",i+1))>=0;)o++;if("::"===t.substr(0,2)&&o--,"::"===t.substr(-2,2)&&o--,o>e)return null;for(n=e-o,r=":";n--;)r+="0:";return":"===(t=t.replace("::",r))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),e=function(){const e=t.split(":"),r=[];for(let t=0;t<e.length;t++)r.push(parseInt(e[t],16));return r}(),{parts:e,zoneId:s}}function u(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;n>0;){if(o=r-n,o<0&&(o=0),t[i]>>o!=e[i]>>o)return!1;n-=r,i+=1}return!0}function f(t){if(o.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(n.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function h(t,e){for(;t.length<e;)t=`0${t}`;return t}const d={};d.IPv4=function(){function t(t){if(4!==t.length)throw new Error("ipaddr: ipv4 octet count should be 4");let e,r;for(e=0;e<t.length;e++)if(r=t[e],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=t}return t.prototype.SpecialRanges={unspecified:[[new t([0,0,0,0]),8]],broadcast:[[new t([255,255,255,255]),32]],multicast:[[new t([224,0,0,0]),4]],linkLocal:[[new t([169,254,0,0]),16]],loopback:[[new t([127,0,0,0]),8]],carrierGradeNat:[[new t([100,64,0,0]),10]],private:[[new t([10,0,0,0]),8],[new t([172,16,0,0]),12],[new t([192,168,0,0]),16]],reserved:[[new t([192,0,0,0]),24],[new t([192,0,2,0]),24],[new t([192,88,99,0]),24],[new t([198,18,0,0]),15],[new t([198,51,100,0]),24],[new t([203,0,113,0]),24],[new t([240,0,0,0]),4]]},t.prototype.kind=function(){return"ipv4"},t.prototype.match=function(t,e){let r;if(void 0===e&&(r=t,t=r[0],e=r[1]),"ipv4"!==t.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,t.octets,8,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,o,i;for(n=3;n>=0;n-=1){if(o=this.octets[n],!(o in r))return null;if(i=r[o],e&&0!==i)return null;8!==i&&(e=!0),t+=i}return 32-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),d.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[];let i=0;for(;i<4;)o.push(parseInt(r[i],10)|255^parseInt(n[i],10)),i++;return new this(o)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(t){return null!==this.parser(t)},d.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},d.IPv4.isValidFourPartDecimal=function(t){return!(!d.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(t){let e,r,n,o,i;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},d.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(t){let e,n,o;if(e=t.match(r.fourOctet))return function(){const t=e.slice(1,6),r=[];for(let e=0;e<t.length;e++)n=t[e],r.push(f(n));return r}();if(e=t.match(r.longValue)){if(o=f(e[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(o>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(o=f(t[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(o>>16&255),r.push(o>>8&255),r.push(255&o),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(o=f(t[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(o>>8&255),r.push(255&o),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r<n;)e[r]=255,r++;return n<4&&(e[n]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},d.IPv6=function(){function t(t,e){let r,n;if(16===t.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(t[r]<<8|t[r+1]);else{if(8!==t.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=t}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");e&&(this.zoneId=e)}return t.prototype.SpecialRanges={unspecified:[new t([0,0,0,0,0,0,0,0]),128],linkLocal:[new t([65152,0,0,0,0,0,0,0]),10],multicast:[new t([65280,0,0,0,0,0,0,0]),8],loopback:[new t([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new t([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new t([0,0,0,0,0,65535,0,0]),96],rfc6145:[new t([0,0,0,0,65535,0,0,0]),96],rfc6052:[new t([100,65435,0,0,0,0,0,0]),96],"6to4":[new t([8194,0,0,0,0,0,0,0]),16],teredo:[new t([8193,0,0,0,0,0,0,0]),32],reserved:[[new t([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new t([8193,2,0,0,0,0,0,0]),48],amt:[new t([8193,3,0,0,0,0,0,0]),32],as112v6:[new t([8193,4,274,0,0,0,0,0]),48],deprecated:[new t([8193,16,0,0,0,0,0,0]),28],orchid2:[new t([8193,32,0,0,0,0,0,0]),28]},t.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},t.prototype.kind=function(){return"ipv6"},t.prototype.match=function(t,e){let r;if(void 0===e&&(r=t,t=r[0],e=r[1]),"ipv6"!==t.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,t.parts,16,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let n,o;for(let i=7;i>=0;i-=1){if(n=this.parts[i],!(n in r))return null;if(o=r[n],e&&0!==o)return null;16!==o&&(e=!0),t+=o}return 128-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],r=this.parts;for(let n=0;n<r.length;n++)t=r[n],e.push(t>>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(h(this.parts[e].toString(16),4));return t}.call(this).join(":");let e="";return this.zoneId&&(e=`%${this.zoneId}`),t+e},t.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const t=this.parts.slice(-2),e=t[0],r=t[1];return new d.IPv4([e>>8,255&e,r>>8,255&r])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(this.parts[e].toString(16));return t}.call(this).join(":");let e="";return this.zoneId&&(e=`%${this.zoneId}`),t+e},t.prototype.toRFC5952String=function(){const t=/((^|:)(0(:|$)){2,})/g,e=this.toNormalizedString();let r,n=0,o=-1;for(;r=t.exec(e);)r[0].length>o&&(n=r.index,o=r[0].length);return o<0?e:`${e.substring(0,n)}::${e.substring(n+o)}`},t.prototype.toString=function(){return this.toRFC5952String()},t}(),d.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[];let i=0;for(;i<16;)o.push(parseInt(r[i],10)|255^parseInt(n[i],10)),i++;return new this(o)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(t){return null!==this.parser(t)},d.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(t){return!1}},d.IPv6.networkAddressFromCIDR=function(t){let e,r,n,o,i;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},d.IPv6.parseCIDR=function(t){let e,r,n;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return n=[this.parse(r[1]),e],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(t){let e,r,n,o,i,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return c(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=c(n[1].slice(0,-1)+s,6),e.parts)){for(i=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<i.length;r++)if(o=i[r],!(0<=o&&o<=255))return null;return e.parts.push(i[0]<<8|i[1]),e.parts.push(i[2]<<8|i[3]),{parts:e.parts,zoneId:e.zoneId}}return null},d.IPv6.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r<n;)e[r]=255,r++;return n<16&&(e[n]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},d.fromByteArray=function(t){const e=t.length;if(4===e)return new d.IPv4(t);if(16===e)return new d.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},d.isValid=function(t){return d.IPv6.isValid(t)||d.IPv4.isValid(t)},d.parse=function(t){if(d.IPv6.isValid(t))return d.IPv6.parse(t);if(d.IPv4.isValid(t))return d.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},d.parseCIDR=function(t){try{return d.IPv6.parseCIDR(t)}catch(e){try{return d.IPv4.parseCIDR(t)}catch(t){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},d.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},d.subnetMatch=function(t,e,r){let n,o,i,s;for(o in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,o))for(i=e[o],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(s=i[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return o;return r},On.exports?On.exports=d:t.ipaddr=d}(e);var Mn=Dn.exports;const Vn=2147483647,zn=36,Wn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},jn=Math.floor,Fn=String.fromCharCode;function Kn(t){throw new RangeError(Wn[t])}const Hn=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},Gn=function(t,e,r){let n=0;for(t=r?jn(t/700):t>>1,t+=jn(t/e);t>455;n+=zn)t=jn(t/35);return jn(n+36*t/(t+38))},qn=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const o=t.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&o)<<10)+(1023&n)+65536):(e.push(o),r--)}else e.push(o)}return e}(t);const r=t.length;let n=128,o=0,i=72;for(const r of t)r<128&&e.push(Fn(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=Vn;for(const e of t)e>=n&&e<r&&(r=e);const c=a+1;r-n>jn((Vn-o)/c)&&Kn("overflow"),o+=(r-n)*c,n=r;for(const r of t)if(r<n&&++o>Vn&&Kn("overflow"),r===n){let t=o;for(let r=zn;;r+=zn){const n=r<=i?1:r>=i+26?26:r-i;if(t<n)break;const o=t-n,s=zn-n;e.push(Fn(Hn(n+o%s,0))),t=jn(o/s)}e.push(Fn(Hn(t,0))),i=Gn(o,c,a===s),o=0,++a}++o,++n}return e.join("")},Yn=BigInt(2**32-1),$n=BigInt(32);function Zn(t,e=!1){return e?{h:Number(t&Yn),l:Number(t>>$n&Yn)}:{h:0|Number(t>>$n&Yn),l:0|Number(t&Yn)}}const Xn={fromBig:Zn,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:i,l:s}=Zn(t[o],e);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<$n|BigInt(e>>>0),shrSH:(t,e,r)=>t>>>r,shrSL:(t,e,r)=>t<<32-r|e>>>r,rotrSH:(t,e,r)=>t>>>r|e<<32-r,rotrSL:(t,e,r)=>t<<32-r|e>>>r,rotrBH:(t,e,r)=>t<<64-r|e>>>r-32,rotrBL:(t,e,r)=>t>>>r-32|e<<64-r,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:(t,e,r)=>t<<r|e>>>32-r,rotlSL:(t,e,r)=>e<<r|t>>>32-r,rotlBH:(t,e,r)=>e<<r-32|t>>>64-r,rotlBL:(t,e,r)=>t<<r-32|e>>>64-r,add:function(t,e,r,n){const o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}},add3L:(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),add3H:(t,e,r,n)=>e+r+n+(t/2**32|0)|0,add4L:(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),add4H:(t,e,r,n,o)=>e+r+n+o+(t/2**32|0)|0,add5H:(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0,add5L:(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0)};var Qn=Xn;const[Jn,to]=(()=>Qn.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),eo=new Uint32Array(80),ro=new Uint32Array(80);class no extends xe{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:f,Fl:h,Gh:d,Gl:p,Hh:l,Hl:y}=this;return[t,e,r,n,o,i,s,a,c,u,f,h,d,p,l,y]}set(t,e,r,n,o,i,s,a,c,u,f,h,d,p,l,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|p,this.Hh=0|l,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)eo[r]=t.getUint32(e),ro[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|eo[t-15],r=0|ro[t-15],n=Qn.rotrSH(e,r,1)^Qn.rotrSH(e,r,8)^Qn.shrSH(e,r,7),o=Qn.rotrSL(e,r,1)^Qn.rotrSL(e,r,8)^Qn.shrSL(e,r,7),i=0|eo[t-2],s=0|ro[t-2],a=Qn.rotrSH(i,s,19)^Qn.rotrBH(i,s,61)^Qn.shrSH(i,s,6),c=Qn.rotrSL(i,s,19)^Qn.rotrBL(i,s,61)^Qn.shrSL(i,s,6),u=Qn.add4L(o,c,ro[t-7],ro[t-16]),f=Qn.add4H(u,n,a,eo[t-7],eo[t-16]);eo[t]=0|f,ro[t]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:h,Fh:d,Fl:p,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=Qn.rotrSH(f,h,14)^Qn.rotrSH(f,h,18)^Qn.rotrBH(f,h,41),b=Qn.rotrSL(f,h,14)^Qn.rotrSL(f,h,18)^Qn.rotrBL(f,h,41),m=f&d^~f&l,v=h&p^~h&y,E=Qn.add5L(w,b,v,to[t],ro[t]),x=Qn.add5H(E,g,e,m,Jn[t],eo[t]),A=0|E,I=Qn.rotrSH(r,n,28)^Qn.rotrBH(r,n,34)^Qn.rotrBH(r,n,39),S=Qn.rotrSL(r,n,28)^Qn.rotrBL(r,n,34)^Qn.rotrBL(r,n,39),B=r&o^r&s^o&s,R=n&i^n&a^i&a;g=0|l,w=0|y,l=0|d,y=0|p,d=0|f,p=0|h,({h:f,l:h}=Qn.add(0|c,0|u,0|x,0|A)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const P=Qn.add3L(A,S,R);r=Qn.add3H(P,x,I,B),n=0|P}({h:r,l:n}=Qn.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=Qn.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=Qn.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=Qn.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:h}=Qn.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:p}=Qn.add(0|this.Fh,0|this.Fl,0|d,0|p)),({h:l,l:y}=Qn.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=Qn.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,h,d,p,l,y,g,w)}roundClean(){eo.fill(0),ro.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const oo=Ee((()=>new no));
12
12
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const io=BigInt(1),so=BigInt(2);function ao(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const co=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function uo(t){if(!ao(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=co[t[r]];return e}function fo(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const ho={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function po(t){return t>=ho._0&&t<=ho._9?t-ho._0:t>=ho._A&&t<=ho._F?t-(ho._A-10):t>=ho._a&&t<=ho._f?t-(ho._a-10):void 0}function lo(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,o=0;e<r;e++,o+=2){const r=po(t.charCodeAt(o)),i=po(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function yo(t){if(!ao(t))throw new Error("Uint8Array expected");return fo(uo(Uint8Array.from(t).reverse()))}function go(t,e){return lo(t.toString(16).padStart(2*e,"0"))}function wo(t,e){return go(t,e).reverse()}function bo(t,e,r){let n;if("string"==typeof e)try{n=lo(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!ao(e))throw new Error(`${t} must be hex string or Uint8Array`);n=Uint8Array.from(e)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${t} expected ${r} bytes, got ${o}`);return n}function mo(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!ao(n))throw new Error("Uint8Array expected");e+=n.length}let r=new Uint8Array(e),n=0;for(let e=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}const vo=t=>(so<<BigInt(t-1))-io,Eo={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||ao(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function xo(t,e,r={}){const n=(e,r,n)=>{const o=Eo[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=t[e];if(!(n&&void 0===i||o(i,t)))throw new Error(`Invalid param ${String(e)}=${i} (${typeof i}), expected ${r}`)};for(const[t,r]of Object.entries(e))n(t,r,!1);for(const[t,e]of Object.entries(r))n(t,e,!0);return t}
13
13
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ao=BigInt(0),Io=BigInt(1),So=BigInt(2),Bo=BigInt(3),Ro=BigInt(4),Po=BigInt(5),ko=BigInt(8);function To(t,e){const r=t%e;return r>=Ao?r:e+r}function _o(t,e,r){if(r<=Ao||e<Ao)throw new Error("Expected power/modulo > 0");if(r===Io)return Ao;let n=Io;for(;e>Ao;)e&Io&&(n=n*t%r),t=t*t%r,e>>=Io;return n}function Uo(t,e,r){let n=t;for(;e-- >Ao;)n*=n,n%=r;return n}function Lo(t,e){if(t===Ao||e<=Ao)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=To(t,e),n=e,o=Ao,i=Io;for(;r!==Ao;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==Io)throw new Error("invert: does not exist");return To(o,e)}function Co(t){if(t%Ro===Bo){const e=(t+Io)/Ro;return function(t,r){const n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw new Error("Cannot find square root");return n}}if(t%ko===Po){const e=(t-Po)/ko;return function(t,r){const n=t.mul(r,So),o=t.pow(n,e),i=t.mul(r,o),s=t.mul(t.mul(i,So),o),a=t.mul(i,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-Io)/So;let r,n,o;for(r=t-Io,n=0;r%So===Ao;r/=So,n++);for(o=So;o<t&&_o(o,e,t)!==t-Io;o++);if(1===n){const e=(t+Io)/Ro;return function(t,r){const n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw new Error("Cannot find square root");return n}}const i=(r+Io)/So;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=n,c=t.pow(t.mul(t.ONE,o),r),u=t.pow(s,i),f=t.pow(s,r);for(;!t.eql(f,t.ONE);){if(t.eql(f,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(f);e<a&&!t.eql(r,t.ONE);e++)r=t.sqr(r);const r=t.pow(c,Io<<BigInt(a-e-1));c=t.sqr(r),u=t.mul(u,r),f=t.mul(f,c),a=e}return u}}(t)}BigInt(9),BigInt(16);const Oo=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function No(t,e){const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}