@bonfida/spl-name-service 2.4.1 → 2.5.0
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/bindings.d.ts +14 -1
- package/dist/constants.d.ts +2 -0
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/instructions.d.ts +23 -0
- package/dist/utils.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7,14 +7,14 @@ read:function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,h=r?i-1:0,d=r?
|
|
|
7
7
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8
8
|
* @license MIT
|
|
9
9
|
*/
|
|
10
|
-
!function(t){const e=a,r=y,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(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 u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|p(t,e);let n=o(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(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(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(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 s.from(n,e,r);const i=function(t){if(s.isBuffer(t)){const e=0|l(t.length),r=o(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)?o(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.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 c(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 c(t),o(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(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,s.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 p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(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 i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!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 U(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(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,i){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=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){let o,s=1,a=t.length,u=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,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(t,o+n)!==c(e,n)){r=!1;break}if(r)return o}return-1}function v(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/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 X(q(e,t.length-r),t,r,n)}function A(t,e,r,n){return X(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 B(t,e,r,n){return X($(e),t,r,n)}function I(t,e,r,n){return X(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(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 x(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}t.kMaxLength=i,s.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}}(),s.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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},s.allocUnsafe=function(t){return f(t)},s.allocUnsafeSlow=function(t){return f(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.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 i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))i+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.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},s.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},s.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},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):g.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.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&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.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===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r);for(let t=0;t<u;++t)if(c[t]!==f[t]){o=c[t],a=f[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},s.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 i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!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 A(this,t,e,r);case"base64":return B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function _(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function U(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=K[t[n]];return i}function L(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function P(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 T(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)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,i){V(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;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,i){V(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;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,i,o){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,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function W(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.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,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(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)})),s.prototype.readBigInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(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)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return W(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return W(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.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 i=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),i},s.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&&!s.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 i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=s.isBuffer(t)?t:s.from(t,n),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%a]}return this};const z={};function M(t,e,r){z[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 j(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 V(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(n,i,o)}function F(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}M("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),M("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),M("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(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 K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(s);const g=new t("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const w=new t("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t("So11111111111111111111111111111111111111112"),new t("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.s16=b.s8=b.nu64be=b.u48be=b.u40be=b.u32be=b.u24be=b.u16be=b.nu64=b.u48=b.u40=nt=b.u32=b.u24=b.u16=rt=b.u8=b.offset=b.greedy=b.Constant=b.UTF8=b.CString=b.Blob=b.Boolean=b.BitField=b.BitStructure=b.VariantLayout=b.Union=b.UnionLayoutDiscriminator=b.UnionDiscriminator=b.Structure=b.Sequence=b.DoubleBE=b.Double=b.FloatBE=b.Float=b.NearInt64BE=b.NearInt64=b.NearUInt64BE=b.NearUInt64=b.IntBE=b.Int=b.UIntBE=b.UInt=b.OffsetLayout=b.GreedyCount=b.ExternalLayout=b.bindConstructorLayout=b.nameWithProperty=b.Layout=b.uint8ArrayToBuffer=b.checkUint8Array=void 0,b.constant=b.utf8=b.cstr=ot=b.blob=b.unionLayoutDiscriminator=b.union=b.seq=b.bits=it=b.struct=b.f64be=b.f64=b.f32be=b.f32=b.ns64be=b.s48be=b.s40be=b.s32be=b.s24be=b.s16be=b.ns64=b.s48=b.s40=b.s32=b.s24=void 0;const m=s;function v(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function E(t){return v(t),m.Buffer.from(t.buffer,t.byteOffset,t.length)}b.checkUint8Array=v,b.uint8ArrayToBuffer=E;class A{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 B(t,e){return e.property?t+"["+e.property+"]":t}b.Layout=A,b.nameWithProperty=B,b.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 A))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 I extends A{isCount(){throw new Error("ExternalLayout is abstract")}}b.ExternalLayout=I;class S extends I{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){v(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}b.GreedyCount=S;class x extends I{constructor(t,e=0,r){if(!(t instanceof A))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 k||this.layout instanceof R}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)}}b.OffsetLayout=x;class k extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntLE(t,r,this.span),this.span}}b.UInt=k;class R extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntBE(t,r,this.span),this.span}}b.UIntBE=R;class _ extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeIntLE(t,r,this.span),this.span}}b.Int=_;class U extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeIntBE(t,r,this.span),this.span}}b.IntBE=U;const L=Math.pow(2,32);function P(t){const e=Math.floor(t/L);return{hi32:e,lo32:t-e*L}}function T(t,e){return t*L+e}class C extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}b.NearUInt64=C;class O extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearUInt64BE=O;class N extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}b.NearInt64=N;class D extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearInt64BE=D;class W extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatLE(e)}encode(t,e,r=0){return E(e).writeFloatLE(t,r),4}}b.Float=W;class z extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatBE(e)}encode(t,e,r=0){return E(e).writeFloatBE(t,r),4}}b.FloatBE=z;class M extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleLE(e)}encode(t,e,r=0){return E(e).writeDoubleLE(t,r),8}}b.Double=M;class j extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleBE(e)}encode(t,e,r=0){return E(e).writeDoubleBE(t,r),8}}b.DoubleBE=j;class V extends A{constructor(t,e,r){if(!(t instanceof A))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof I&&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 I)&&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 I&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t,e=0){const r=[];let n=0,i=this.count;for(i instanceof I&&(i=i.decode(t,e));n<i;)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,i=t.reduce(((t,i)=>t+n.encode(i,e,r+t)),0);return this.count instanceof I&&this.count.encode(t.length,e,r),i}}b.Sequence=V;class F extends A{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof A),!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 i=n.getSpan(t,e);return e+=i,r+i}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){v(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 i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-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)}}}b.Structure=F;class H{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}b.UnionDiscriminator=H;class G extends H{constructor(t,e){if(!(t instanceof I&&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)}}b.UnionLayoutDiscriminator=G;class q extends A{constructor(t,e,r){let n;if(t instanceof k||t instanceof R)n=new G(new x(t));else if(t instanceof I&&t.isCount())n=new G(t);else{if(!(t instanceof H))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 A))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 i=-1;e&&(i=e.span,0<=i&&(t instanceof k||t instanceof R)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof k||t instanceof R,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=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,i=n.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=i,r[o.property]=o.decode(t,e+s)}else r=o.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(t[n.property],e,r),o+i.encode(t[i.property],e,r+o)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new $(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]}}b.Union=q;class $ extends A{constructor(t,e,r,n){if(!(t instanceof q))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 A))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 i=t.span;0>t.span&&(i=r?r.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,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 i=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),i+=this.layout.getSpan(e,r+n),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function X(t){return 0>t&&(t+=4294967296),t}b.VariantLayout=$;class Y extends A{constructor(t,e,r){if(!(t instanceof k||t instanceof R))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=X(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 Z(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new K(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}}b.BitStructure=Y;class Z{constructor(t,e,r){if(!(t instanceof Y))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,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>n)throw new Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-e),this.wordMask=X(this.valueMask<<this.start),this.property=r}decode(t,e){return X(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==X(t&this.valueMask))throw new TypeError(B("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=X(t<<this.start);this.container._packedSetValue(X(e&~this.wordMask)|r)}}b.BitField=Z;class K extends Z{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)}}b.Boolean=K;class Q extends A{constructor(t,e){if(!(t instanceof I&&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 I||(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)),E(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof I&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(B("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=E(t);return E(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof I&&this.length.encode(n,e,r),n}}b.Blob=Q;class J extends A{constructor(t){super(-1,t)}getSpan(t,e=0){v(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 E(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(r+i>e.length)throw new RangeError("encoding overruns Buffer");const o=E(e);return n.copy(o,r),o[r+i]=0,i+1}}b.CString=J;class tt extends A{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 v(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 E(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(r+i>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(E(e),r),i}}b.UTF8=tt;class et extends A{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}b.Constant=et,b.greedy=(t,e)=>new S(t,e),b.offset=(t,e,r)=>new x(t,e,r);var rt=b.u8=t=>new k(1,t);b.u16=t=>new k(2,t),b.u24=t=>new k(3,t);var nt=b.u32=t=>new k(4,t);b.u40=t=>new k(5,t),b.u48=t=>new k(6,t),b.nu64=t=>new C(t),b.u16be=t=>new R(2,t),b.u24be=t=>new R(3,t),b.u32be=t=>new R(4,t),b.u40be=t=>new R(5,t),b.u48be=t=>new R(6,t),b.nu64be=t=>new O(t),b.s8=t=>new _(1,t),b.s16=t=>new _(2,t),b.s24=t=>new _(3,t),b.s32=t=>new _(4,t),b.s40=t=>new _(5,t),b.s48=t=>new _(6,t),b.ns64=t=>new N(t),b.s16be=t=>new U(2,t),b.s24be=t=>new U(3,t),b.s32be=t=>new U(4,t),b.s40be=t=>new U(5,t),b.s48be=t=>new U(6,t),b.ns64be=t=>new D(t),b.f32=t=>new W(t),b.f32be=t=>new z(t),b.f64=t=>new M(t),b.f64be=t=>new j(t);var it=b.struct=(t,e,r)=>new F(t,e,r);b.bits=(t,e,r)=>new Y(t,e,r),b.seq=(t,e,r)=>new V(t,e,r),b.union=(t,e,r)=>new q(t,e,r),b.unionLayoutDiscriminator=(t,e)=>new G(t,e);var ot=b.blob=(t,e)=>new Q(t,e);b.cstr=t=>new J(t),b.utf8=(t,e)=>new tt(t,e),b.constant=(t,e)=>new et(t,e);const st=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var at={};Object.defineProperty(at,"__esModule",{value:!0});var ut=at.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};at.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var ct=at.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}};at.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const ft=(ht=8,t=>{const e=ot(ht,t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>{const r=n(t,e);return ut(Buffer.from(r))},i.encode=(t,e,n)=>{const i=ct(t,ht);return r(i,e,n)},i});var ht;const dt=t=>{const e=rt(t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>!!n(t,e),i.encode=(t,e,n)=>{const i=Number(t);return r(i,e,n)},i},lt=e=>{const r=ot(32,e),{encode:n,decode:i}=st(r),o=r;return o.decode=(e,r)=>{const n=i(e,r);return new t(n)},o.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},o};class pt extends Error{constructor(t){super(t)}}class yt extends pt{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class gt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class wt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class bt extends pt{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class mt extends pt{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(vt||(vt={}));const Et=1,At=it([rt("m"),rt("n"),dt("isInitialized"),lt("signer1"),lt("signer2"),lt("signer3"),lt("signer4"),lt("signer5"),lt("signer6"),lt("signer7"),lt("signer8"),lt("signer9"),lt("signer10"),lt("signer11")]).span;var Bt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(Bt||(Bt={}));const It=it([lt("mint"),lt("owner"),ft("amount"),nt("delegateOption"),lt("delegate"),rt("state"),nt("isNativeOption"),ft("isNative"),ft("delegatedAmount"),nt("closeAuthorityOption"),lt("closeAuthority")]),St=It.span,xt=it([nt("mintAuthorityOption"),lt("mintAuthority"),ft("supply"),rt("decimals"),dt("isInitialized"),nt("freezeAuthorityOption"),lt("freezeAuthority")]),kt=xt.span;async function Rt(t,e,r,n=g){return function(t,e,r=g){if(!e)throw new yt;if(!e.owner.equals(r))throw new gt;if(e.data.length<kt)throw new wt;const n=xt.decode(e.data.slice(0,kt));let i=Buffer.alloc(0);if(e.data.length>kt){if(e.data.length<=St)throw new wt;if(e.data.length===At)throw new wt;if(e.data[St]!=vt.Mint)throw new bt;i=e.data.slice(St+Et)}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:i}}(e,await t.getAccountInfo(e,r),n)}function _t(e,r,n=!1,i=g,o=w){if(!n&&!t.isOnCurve(r.toBuffer()))throw new mt;const[s]=t.findProgramAddressSync([r.toBuffer(),i.toBuffer(),e.toBuffer()],o);return s}function Ut(t,n,i,o,s=g,a=w){return function(t,n,i,o,s,a=g,u=w){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new r({keys:c,programId:u,data:s})}(t,n,i,o,Buffer.from([1]),s,a)}var Lt;!function(t){t.SymbolNotFound="SymbolNotFound",t.InvalidSubdomain="InvalidSubdomain",t.FavouriteDomainNotFound="FavouriteDomainNotFound",t.MissingParentOwner="MissingParentOwner",t.U32Overflow="U32Overflow",t.InvalidBufferLength="InvalidBufferLength",t.U64Overflow="U64Overflow",t.NoRecordData="NoRecordData",t.InvalidRecordData="InvalidRecordData",t.UnsupportedRecord="UnsupportedRecord",t.InvalidEvmAddress="InvalidEvmAddress",t.InvalidInjectiveAddress="InvalidInjectiveAddress",t.InvalidARecord="InvalidARecord",t.InvalidAAAARecord="InvalidAAAARecord",t.InvalidRecordInput="InvalidRecordInput",t.InvalidSignature="InvalidSignature",t.AccountDoesNotExist="AccountDoesNotExist",t.MultipleRegistries="MultipleRegistries",t.InvalidReverseTwitter="InvalidReverseTwitter",t.NoAccountData="NoAccountData",t.InvalidInput="InvalidInput",t.InvalidDomain="InvalidDomain",t.InvalidCustomBg="InvalidCustomBackground",t.UnsupportedSignature="UnsupportedSignature",t.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",t.RecordIsNotSigned="RecordIsNotSigned",t.UnsupportedSignatureType="UnsupportedSignatureType",t.InvalidSolRecordV2="InvalidSolRecordV2",t.MissingVerifier="MissingVerifier",t.PythFeedNotFound="PythFeedNotFound"}(Lt||(Lt={}));class Pt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,Pt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new Pt(Lt.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 Ct{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new Pt(Lt.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new Ct(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ot,Nt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Dt=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 i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](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}(),Wt=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),i=this.view[n](this.offset,!0);return this.offset+=r,i},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}(),zt=(Ot=function(t,e){return Ot=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])},Ot(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}Ot(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Mt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function jt(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=Nt.concat(["bool","string"]),Ft=["option","enum","array","set","map","struct"],Ht=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return zt(e,t),e}(Error);function Gt(t){if("string"!=typeof t||!Vt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Ft.includes(e[0])){var r=e[0];if("option"===r)return Gt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Ht(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');Gt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Gt(t.type);throw new Ht(t,"{ type, len? }")}(t[r]);if("set"===r)return Gt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Ht(t,"{ key, value }");Gt(t.key),Gt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"object");for(var e in t)Gt(t[e])}(t[r])}}throw new Ht(t,Ft.join(", ")+" or "+Vt.join(", "))}}var qt=function(){function t(t){this.encoded=new Dt,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(Nt.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&&Mt(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),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Mt(t,"string",this.fieldPath);for(var e=t,r=[],n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?r.push(i):i<2048?r.push(192|i>>6,128|63&i):i<55296||i>=57344?r.push(224|i>>12,128|i>>6&63,128|63&i):(n++,i=65536+((1023&i)<<10|1023&e.charCodeAt(n)),r.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}this.encoded.store_value(r.length,"u32"),this.encoded.store_bytes(new Uint8Array(r))},t.prototype.encode_boolean=function(t){this.checkTypes&&Mt(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 i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}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?jt(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?jt(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&&Mt(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,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Mt(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 i=0,o=n;i<o.length;i++){var s=o[i];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&&Mt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),$t=function(){function t(t){this.buffer=new Wt(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Nt.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)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},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 i=e[n];if(i<128)r.push(i);else if(i<224)r.push((31&i)<<6|63&e[++n]);else if(i<240)r.push((15&i)<<12|(63&e[++n])<<6|63&e[++n]);else{var o=(7&i)<<18|(63&e[++n])<<12|(63&e[++n])<<6|63&e[++n];r.push(o)}}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,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),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 i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}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 Xt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new qt(r).encode(e,t)}function Yt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new $t(e).decode(t)}function Zt(e,n,i,o,a,u,c,f,h,d,l){const p=[s.Buffer.from(Int8Array.from([0])),new Tt(u.length).toBuffer(),u,c.toBuffer(),f.toBuffer()],y=s.Buffer.concat(p),g=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1}];return h?g.push({pubkey:h,isSigner:!0,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d?g.push({pubkey:d,isSigner:!1,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),l&&g.push({pubkey:l,isSigner:!0,isWritable:!1}),new r({keys:g,programId:e,data:y})}function Kt(t,e,n,i,o){const a=[s.Buffer.from(Int8Array.from([1])),n.toBuffer(),new Tt(i.length).toBuffer(),i],u=s.Buffer.concat(a);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:u})}function Qt(e,n,i,o,a,u,c){const f=[s.Buffer.from(Int8Array.from([2])),i.toBuffer()],h=s.Buffer.concat(f),d=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:c||o,isSigner:!0,isWritable:!1}];return a&&d.push({pubkey:a,isSigner:!0,isWritable:!1}),c&&u&&(a||d.push({pubkey:t.default,isSigner:!1,isWritable:!1}),d.push({pubkey:u,isSigner:!1,isWritable:!1})),new r({keys:d,programId:e,data:h})}function Jt(t,e,n,i){const o=[s.Buffer.from(Int8Array.from([3]))],a=s.Buffer.concat(o);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0}],programId:t,data:a})}class te{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Xt(te.schema,this)}getInstruction(t,n,i,o,a,u,c,f,h,d,l){const p=s.Buffer.from(this.serialize()),y=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!0},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:f,isSigner:!0,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:g,isSigner:!1,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!1}];return new r({keys:y,programId:t,data:p})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(t){this.tag=12,this.name=t.name}serialize(){return Xt(ee.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!1}),l.push({pubkey:a,isSigner:!1,isWritable:!1}),l.push({pubkey:u,isSigner:!0,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),f&&l.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&l.push({pubkey:h,isSigner:!0,isWritable:!0}),new r({keys:l,programId:t,data:d})}}ee.schema={struct:{tag:"u8",name:"string"}};class re{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Xt(re.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,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:l,isSigner:!1,isWritable:!1}),v.push({pubkey:p,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 r({keys:v,programId:t,data:m})}}re.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class ne{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Xt(ne.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,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:l,isSigner:!1,isWritable:!0}),v.push({pubkey:p,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 r({keys:v,programId:t,data:m})}}ne.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ie{constructor(){this.tag=16}serialize(){return Xt(ie.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!0}),l.push({pubkey:a,isSigner:!1,isWritable:!0}),l.push({pubkey:u,isSigner:!1,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),l.push({pubkey:f,isSigner:!0,isWritable:!1}),l.push({pubkey:h,isSigner:!1,isWritable:!0}),new r({keys:l,programId:t,data:d})}}function oe(t,e,n,i,o,a){const u=[s.Buffer.from(Int8Array.from([4])),a.toBuffer()],c=s.Buffer.concat(u);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:c})}ie.schema={struct:{tag:"u8"}};class se{constructor(){this.tag=6}serialize(){return Xt(se.schema,this)}getInstruction(t,e,n,i,o){const a=s.Buffer.from(this.serialize());let u=[];return u.push({pubkey:e,isSigner:!1,isWritable:!1}),u.push({pubkey:n,isSigner:!1,isWritable:!0}),u.push({pubkey:i,isSigner:!0,isWritable:!0}),u.push({pubkey:o,isSigner:!1,isWritable:!1}),new r({keys:u,programId:t,data:a})}}se.schema={struct:{tag:"u8"}};const ae=new t("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ue=s.Buffer.from("tokenized_name"),ce=e=>{const[r]=t.findProgramAddressSync([ue,e.toBuffer()],ae);return r};var fe;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(fe||(fe={}));class he{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t(e.nameAccount),this.owner=new t(e.owner),this.nftMint=new t(e.nftMint)}static deserialize(t){return new he(Yt(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.findProgramAddress([s.Buffer.from("nft_record"),e.toBuffer()],r)}}he.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 de=async(e,r)=>{try{const n=ce(r);if("0"===(await Rt(e,n)).supply.toString())return;const i=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],o=await e.getProgramAccounts(g,{filters:i});if(1!=o.length)return;return new t(o[0].account.data.slice(32,64))}catch{return}},le=async e=>{const r=await e.getProgramAccounts(ae,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t(e.account.data.slice(66,98))))},pe=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ye=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(ae,{filters:r})})(t,e.mint);if(1===r.length)return he.deserialize(r[0].account.data)},ge=async(t,e)=>{const r=[...pe(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(g,{filters:r})).map((t=>It.decode(t.account.data))).map((e=>ye(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class we{constructor(e){this.parentName=new t(e.parentName),this.owner=new t(e.owner),this.class=new t(e.class)}static deserialize(t){const e=new we(Yt(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 Pt(Lt.AccountDoesNotExist);const i=new we(Yt(this.schema,n.data));i.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:i,nftOwner:await de(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new we(Yt(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 be(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 me(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")}we.HEADER_LEN=96,we.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const ve="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
|
|
11
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ee(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Ae=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Be=(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 Ie(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function Se(t){if("string"==typeof t&&(t=Ie(t)),!Ee(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class xe{clone(){return this._cloneInto()}}function ke(t){const e=e=>t().update(Se(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class Re extends xe{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=Ae(this.buffer)}update(t){me(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=Se(t)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=Ae(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){me(this),function(t,e){be(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:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Ae(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,c[t],i)}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:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const _e=(t,e,r)=>t&e^~t&r,Ue=(t,e,r)=>t&e^t&r^e&r,Le=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]),Pe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=new Uint32Array(64);class Ce extends Re{constructor(){super(64,32,8,!1),this.A=0|Pe[0],this.B=0|Pe[1],this.C=0|Pe[2],this.D=0|Pe[3],this.E=0|Pe[4],this.F=0|Pe[5],this.G=0|Pe[6],this.H=0|Pe[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Te[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Te[t-15],r=Te[t-2],n=Be(e,7)^Be(e,18)^e>>>3,i=Be(r,17)^Be(r,19)^r>>>10;Te[t]=i+Te[t-7]+n+Te[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(Be(s,6)^Be(s,11)^Be(s,25))+_e(s,a,u)+Le[t]+Te[t]|0,f=(Be(r,2)^Be(r,13)^Be(r,22))+Ue(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Oe=ke((()=>new Ce)),Ne=new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),De="SPL Name Service",We=new t("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),ze=new t("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Me=new t("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),je=new t("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Ve=new t("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Fe=new t("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),He=new t("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ge=96,qe=new t("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),$e=new t("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Xe=[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new t("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new t("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new t("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ"),new t("XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL")],Ye=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ze=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("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),Qe=new t("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Je=new t("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),tr=new t("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),er=new t("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),rr=new t("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function nr(t,e){if(!await t.getAccountInfo(e))throw new Pt(Lt.AccountDoesNotExist);return we.retrieve(t,e)}async function ir(t){const e=De+t,r=Oe(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)}async function or(e,r,n){const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=await t.findProgramAddress(i,Ne);return o}async function sr(t,e){const r=await ir(e.toBase58()),n=await or(r,Ve),{registry:i}=await we.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);const o=i.data.slice(0,4).readUInt32LE(0);return i.data.slice(4,4+o).toString()}async function ar(t,e){let r=[];for(let t of e){const e=await ir(t.toBase58()),n=await or(e,Ve);r.push(n)}return(await we.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;const e=t.data.slice(0,4).readUInt32LE(0);return t.data.slice(4,4+e).toString()}))}const ur=async(t,e=We)=>{let r=await ir(t);return{pubkey:await or(r,void 0,e),hashed:r}},cr=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=s.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:n}=await ur(r[1]);return{...await ur(t,n),isSub:!0,parent:n}}if(3===r.length&&e){const{pubkey:t}=await ur(r[2]),{pubkey:e}=await ur("\0".concat(r[1]),t),n=s.Buffer.from([1]).toString();return{...await ur(n.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new Pt(Lt.InvalidInput);return{...await ur(t,We),isSub:!1,parent:void 0}},fr=async(t,e)=>{const{pubkey:r,parent:n}=await cr(t),i=await ir(r.toBase58());return await or(i,Ve,e?n:void 0)};var hr,dr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],lr=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 i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](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}(),pr=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),i=this.view[n](this.offset,!0);return this.offset+=r,i},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}(),yr=(hr=function(t,e){return hr=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])},hr(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}hr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function gr(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function wr(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 br=dr.concat(["bool","string"]),mr=["option","enum","array","set","map","struct"],vr=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return yr(e,t),e}(Error);function Er(t){if("string"!=typeof t||!br.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&mr.includes(e[0])){var r=e[0];if("option"===r)return Er(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new vr(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');Er({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new vr(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Er(t.type);throw new vr(t,"{ type, len? }")}(t[r]);if("set"===r)return Er(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new vr(t,"{ key, value }");Er(t.key),Er(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new vr(t,"object");for(var e in t)Er(t[e])}(t[r])}}throw new vr(t,mr.join(", ")+" or "+br.join(", "))}}var Ar=function(){function t(t){this.encoded=new lr,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(dr.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&&gr(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),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&gr(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&&gr(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 i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}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?wr(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?wr(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&&gr(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,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&gr(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 i=0,o=n;i<o.length;i++){var s=o[i];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&&gr(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),Br=function(){function t(t){this.buffer=new pr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(dr.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)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},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,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),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 i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}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 Ir(t,e,r){return void 0===r&&(r=!0),r&&Er(t),new Ar(r).encode(e,t)}class Sr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return Ir(Sr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Sr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class xr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return Ir(xr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}xr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class kr{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return Ir(kr.schema,this)}getInstruction(t,e,n,i,o,s,a,u,c){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:e,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:i,isSigner:!0,isWritable:!0}),h.push({pubkey:o,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:u,isSigner:!1,isWritable:!1}),h.push({pubkey:c,isSigner:!0,isWritable:!0}),new r({keys:h,programId:t,data:f})}}kr.schema={struct:{tag:"u8",staleness:"bool"}};class Rr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return Ir(Rr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Rr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class _r{constructor(){this.tag=5}serialize(){return Ir(_r.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}_r.schema={struct:{tag:"u8"}};class Ur{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return Ir(Ur.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Ur.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const Lr=new t("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Pr]=t.findProgramAddressSync([Lr.toBuffer()],Lr);var Tr,Cr;(Cr=Tr||(Tr={}))[Cr.None=0]="None",Cr[Cr.Solana=1]="Solana",Cr[Cr.Ethereum=2]="Ethereum",Cr[Cr.UnverifiedSolana=3]="UnverifiedSolana";const Or=t=>{switch(t){case Tr.None:return 0;case Tr.Ethereum:return 20;case Tr.Solana:case Tr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Nr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Nr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&Er(e),new Br(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))}}Nr.LEN=8,Nr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Dr{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Nr.deserialize(t.slice(96,96+Nr.LEN)),r=t.slice(96+Nr.LEN);return new Dr(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=Or(this.header.stalenessValidation)+Or(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Or(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Or(this.header.stalenessValidation),e=t+Or(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var Wr;!function(t){t.IPFS="IPFS",t.ARWV="ARWV",t.SOL="SOL",t.ETH="ETH",t.BTC="BTC",t.LTC="LTC",t.DOGE="DOGE",t.Email="email",t.Url="url",t.Discord="discord",t.Github="github",t.Reddit="reddit",t.Twitter="twitter",t.Telegram="telegram",t.Pic="pic",t.SHDW="SHDW",t.POINT="POINT",t.BSC="BSC",t.Injective="INJ",t.Backpack="backpack",t.A="A",t.AAAA="AAAA",t.CNAME="CNAME",t.TXT="TXT",t.Background="background"}(Wr||(Wr={}));const zr=new Map([[Wr.SOL,96],[Wr.ETH,20],[Wr.BSC,20],[Wr.Injective,20],[Wr.A,4],[Wr.AAAA,16],[Wr.Background,32]]);var Mr;!function(t){t[t.V1=1]="V1",t[t.V2=2]="V2"}(Mr||(Mr={}));var jr="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=",Vr="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Fr=0,Hr=-3;function Gr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function qr(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Gr,this.dtree=new Gr}var $r=new Gr,Xr=new Gr,Yr=new Uint8Array(30),Zr=new Uint16Array(30),Kr=new Uint8Array(30),Qr=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]),tn=new Gr,en=new Uint8Array(320);function rn(t,e,r,n){var i,o;for(i=0;i<r;++i)t[i]=0;for(i=0;i<30-r;++i)t[i+r]=i/r|0;for(o=n,i=0;i<30;++i)e[i]=o,o+=1<<t[i]}var nn=new Uint16Array(16);function on(t,e,r,n){var i,o;for(i=0;i<16;++i)t.table[i]=0;for(i=0;i<n;++i)t.table[e[r+i]]++;for(t.table[0]=0,o=0,i=0;i<16;++i)nn[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[nn[e[r+i]]++]=i)}function sn(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function an(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 un(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,i=0,o=t.tag;do{n=2*n+(1&o),o>>>=1,++i,r+=e.table[i],n-=e.table[i]}while(n>=0);return t.tag=o,t.bitcount-=i,e.trans[r+n]}function cn(t,e,r){var n,i,o,s,a,u;for(n=an(t,5,257),i=an(t,5,1),o=an(t,4,4),s=0;s<19;++s)en[s]=0;for(s=0;s<o;++s){var c=an(t,3,0);en[Jr[s]]=c}for(on(tn,en,0,19),a=0;a<n+i;){var f=un(t,tn);switch(f){case 16:var h=en[a-1];for(u=an(t,2,3);u;--u)en[a++]=h;break;case 17:for(u=an(t,3,3);u;--u)en[a++]=0;break;case 18:for(u=an(t,7,11);u;--u)en[a++]=0;break;default:en[a++]=f}}on(e,en,0,n),on(r,en,n,i)}function fn(t,e,r){for(;;){var n,i,o,s,a=un(t,e);if(256===a)return Fr;if(a<256)t.dest[t.destLen++]=a;else for(n=an(t,Yr[a-=257],Zr[a]),i=un(t,r),s=o=t.destLen-an(t,Kr[i],Qr[i]);s<o+n;++s)t.dest[t.destLen++]=t.dest[s]}}function hn(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 Hr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Fr}!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}($r,Xr),rn(Yr,Zr,4,3),rn(Kr,Qr,2,1),Yr[28]=0,Zr[28]=258;var dn=function(t,e){var r,n,i=new qr(t,e);do{switch(r=sn(i),an(i,2,0)){case 0:n=hn(i);break;case 1:n=fn(i,$r,Xr);break;case 2:cn(i,i.ltree,i.dtree),n=fn(i,i.ltree,i.dtree);break;default:n=Hr}if(n!==Fr)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?"function"==typeof i.dest.slice?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest};const ln=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],pn=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var yn={swap32LE:t=>{ln&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)pn(t,r,r+3),pn(t,r+1,r+2)})(t)}};const gn=dn,{swap32LE:wn}=yn;var bn=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=gn(t,new Uint8Array(r)),t=gn(t,new Uint8Array(r)),wn(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]}},mn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,mn.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,i="function"==typeof Buffer,o="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(a),c=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(u),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))},l=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},p=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,i,o="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");o+=u[(e=r<<16|n<<8|i)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},g=n?function(t){return btoa(t)}:i?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=i?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,i=t.length;n<i;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?l(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)},A=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},B=function(t,e){return void 0===e&&(e=!1),e?l(A(t)):A(t)},I=function(t){return B(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=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))}},k=function(t){return t.replace(S,x)},R=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,i="",o=0;o<t.length;)e=c[t.charAt(o++)]<<18|c[t.charAt(o++)]<<12|(r=c[t.charAt(o++)])<<6|(n=c[t.charAt(o++)]),i+=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 i},_=r?function(t){return atob(p(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:R,U=i?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(_(t).split("").map((function(t){return t.charCodeAt(0)})))},L=function(t){return U(T(t))},P=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:o?function(t){return o.decode(U(t))}:function(t){return k(_(t))},T=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return P(T(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 B(this,t)})),t("toBase64URI",(function(){return B(this,!0)})),t("toBase64URL",(function(){return B(this,!0)})),t("toUint8Array",(function(){return L(this)}))},W=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)}))},z=function(){D(),W()},M={version:t,VERSION:e,atob:_,atobPolyfill:R,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:B,encode:B,encodeURI:I,encodeURL:I,utob:E,btou:k,decode:C,isValid:O,fromUint8Array:b,toUint8Array:L,extendString:D,extendUint8Array:W,extendBuiltins:z,Base64:{}};return Object.keys(M).forEach((function(t){return M.Base64[t]=M[t]})),M}();const vn={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},En=jr,An=Vr,Bn=bn,In=mn.exports.Base64,Sn=new Bn(In.toUint8Array(En)),xn=new Bn(In.toUint8Array(An));function kn(t,e){return 0!=(t&e)}const Rn=0,_n=1,Un=2;function Ln(t,e){const r=t.length;let n=0,i=Rn;for(let o=e;o+1<r;o++){const r=t[o+0],s=t[o+1];switch(kn(r,vn.Regional_Indicator)||(n=0),i){case Un:case Rn:i=kn(r,vn.Extended_Pictographic)?_n:Rn;break;case _n:i=kn(r,vn.Extend)?_n:kn(r,vn.ZWJ)&&kn(s,vn.Extended_Pictographic)?Un:Rn}if(!kn(r,vn.CR)||!kn(s,vn.LF)){if(kn(r,vn.Control|vn.CR|vn.LF))return o+1-e;if(kn(s,vn.Control|vn.CR|vn.LF))return o+1-e;if(!(kn(r,vn.L)&&kn(s,vn.L|vn.V|vn.LV|vn.LVT)||kn(r,vn.LV|vn.V)&&kn(s,vn.V|vn.T)||kn(r,vn.LVT|vn.T)&&kn(s,vn.T)||kn(s,vn.Extend|vn.ZWJ)||kn(s,vn.SpacingMark)||kn(r,vn.Prepend)||i===Un)){if(!kn(r,vn.Regional_Indicator)||!kn(s,vn.Regional_Indicator)||n%2!=0)return o+1-e;n++}}}return r-e}var Pn=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const i=t.codePointAt(e);n.push(Sn.get(i)|xn.get(i)),e+=i>65535?2:1,r.push(e)}for(let i=0;i<n.length;){const o=Ln(n,i),s=r[i],a=r[i+o];e.push(t.slice(s,a)),i+=o}return e},Tn=o(Pn);const Cn=t=>{const e=De+t,r=Oe(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)},On=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,Ne);return o};async function Nn(t,e){const r=Cn(e.toBase58()),n=On(r,Ve),{registry:i}=await we.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Yn(i.data)}async function Dn(t,e){let r=[];for(let t of e){const e=Cn(t.toBase58()),n=On(e,Ve);r.push(n)}return(await we.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Yn(t.data)}))}const Wn=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Ve.toBase58()}}],n=await t.getProgramAccounts(Ne,{filters:r}),i=[{memcmp:{offset:0,bytes:e.toBase58()}}],o=await t.getProgramAccounts(Ne,{filters:i,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Yn(t.account.data.slice(96))]))),a=[];return o.forEach((t=>{const r=Gn(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},zn=(t,e=We,r)=>{let n=Cn(t);return{pubkey:On(n,r,e),hashed:n}},Mn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===Mr.V2?Pr:void 0,n=t.split(".");if(2===n.length){const t=s.Buffer.from([e||0]).toString().concat(n[0]),{pubkey:i}=zn(n[1]);return{...zn(t,i,r),isSub:!0,parent:i}}if(3===n.length&&e){const{pubkey:t}=zn(n[2]),{pubkey:i}=zn("\0".concat(n[1]),t),o=e===Mr.V2?"":"";return{...zn(o.concat(n[0]),i,r),isSub:!0,parent:t,isSubRecord:!0}}if(n.length>=3)throw new Pt(Lt.InvalidInput);return{...zn(t,We),isSub:!1,parent:void 0}};async function jn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:We.toBase58()}}];return(await t.getProgramAccounts(Ne,{filters:r})).map((t=>t.pubkey))}async function Vn(t,e){const r=await jn(t,e),n=await Dn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))}const Fn=async t=>{const e=[{memcmp:{offset:0,bytes:We.toBase58()}}];return await t.getProgramAccounts(Ne,{dataSlice:{offset:32,length:32},filters:e})},Hn=(t,e)=>{const{pubkey:r,parent:n}=Mn(t),i=Cn(r.toBase58());return On(i,Ve,e?n:void 0)},Gn=(t,e)=>{const r=Cn(t.toBase58());return On(r,Ve,e)},qn=(t,e)=>{if(!t)throw new Pt(e)},$n=async(t,e)=>{const r=await ge(t,e),n=await Dn(t,r.map((t=>t.nameAccount)));return n.map(((t,e)=>({key:r[e].nameAccount,mint:r[e].nftMint,reverse:t}))).filter((t=>!!t.reverse))},Xn=t=>{switch(Tn(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}};function Yn(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var Zn=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 i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),c=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,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=o-1;(0!==f||h<i)&&-1!==d;d--,h++)f+=s*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,r++}for(var l=o-i;l!==o&&0===c[l];)l++;for(var p=new Uint8Array(n+(o-l)),y=n;l!==o;)p[y++]=c[l++];return p}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,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,l=u-1;(0!==h||d<n)&&-1!==l;l--,d++)h+=256*f[l]>>>0,f[l]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var y=a.repeat(r);p<u;++p)y+=t.charAt(f[p]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var Kn,Qn=Zn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Jn={exports:{}};Kn=Jn,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"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function u(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(o=t.indexOf(":",o+1))>=0;)i++;if("::"===t.substr(0,2)&&i--,"::"===t.substr(-2,2)&&i--,i>e)return null;for(n=e-i,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 c(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),t[o]>>i!=e[o]>>i)return!1;n-=r,o+=1}return!0}function f(t){if(i.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 c(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,i,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],e&&0!==o)return null;8!==o&&(e=!0),t+=o}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(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}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,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}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,i;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(i=f(e[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(i>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(i=f(t[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(i=f(t[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(i>>8&255),r.push(255&i),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 c(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,i;for(let o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],e&&0!==i)return null;16!==i&&(e=!0),t+=i}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,i=-1;for(;r=t.exec(e);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?e:`${e.substring(0,n)}::${e.substring(n+i)}`},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(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}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,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}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,i,o,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return u(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=u(n[1].slice(0,-1)+s,6),e.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return e.parts.push(o[0]<<8|o[1]),e.parts.push(o[2]<<8|o[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,i,o,s;for(i in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,i))for(o=e[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return i;return r},Kn.exports?Kn.exports=d:t.ipaddr=d}(i);var ti=Jn.exports;const ei=2147483647,ri=36,ni={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ii=Math.floor,oi=String.fromCharCode;function si(t){throw new RangeError(ni[t])}const ai=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},ui=function(t,e,r){let n=0;for(t=r?ii(t/700):t>>1,t+=ii(t/e);t>455;n+=ri)t=ii(t/35);return ii(n+36*t/(t+38))},ci=function(t){const e=[],r=t.length;let n=0,i=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)t.charCodeAt(r)>=128&&si("not-basic"),e.push(t.charCodeAt(r));for(let u=s>0?s+1:0;u<r;){const s=n;for(let e=1,i=ri;;i+=ri){u>=r&&si("invalid-input");const s=(a=t.charCodeAt(u++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:ri;s>=ri&&si("invalid-input"),s>ii((ei-n)/e)&&si("overflow"),n+=s*e;const c=i<=o?1:i>=o+26?26:i-o;if(s<c)break;const f=ri-c;e>ii(ei/f)&&si("overflow"),e*=f}const c=e.length+1;o=ui(n-s,c,0==s),ii(n/c)>ei-i&&si("overflow"),i+=ii(n/c),n%=c,e.splice(n++,0,i)}var a;return String.fromCodePoint(...e)},fi=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const i=t.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&i)<<10)+(1023&n)+65536):(e.push(i),r--)}else e.push(i)}return e}(t);const r=t.length;let n=128,i=0,o=72;for(const r of t)r<128&&e.push(oi(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=ei;for(const e of t)e>=n&&e<r&&(r=e);const u=a+1;r-n>ii((ei-i)/u)&&si("overflow"),i+=(r-n)*u,n=r;for(const r of t)if(r<n&&++i>ei&&si("overflow"),r===n){let t=i;for(let r=ri;;r+=ri){const n=r<=o?1:r>=o+26?26:r-o;if(t<n)break;const i=t-n,s=ri-n;e.push(oi(ai(n+i%s,0))),t=ii(i/s)}e.push(oi(ai(t,0))),o=ui(i,u,a===s),i=0,++a}++i,++n}return e.join("")},hi=BigInt(2**32-1),di=BigInt(32);function li(t,e=!1){return e?{h:Number(t&hi),l:Number(t>>di&hi)}:{h:0|Number(t>>di&hi),l:0|Number(t&hi)}}const pi={fromBig:li,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=li(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<di|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 i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},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,i)=>e+r+n+i+(t/2**32|0)|0,add5H:(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,add5L:(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0)};var yi=pi;const[gi,wi]=(()=>yi.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)))))(),bi=new Uint32Array(80),mi=new Uint32Array(80);class vi extends Re{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:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:f,Fl:h,Gh:d,Gl:l,Hh:p,Hl:y}=this;return[t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y]}set(t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)bi[r]=t.getUint32(e),mi[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|bi[t-15],r=0|mi[t-15],n=yi.rotrSH(e,r,1)^yi.rotrSH(e,r,8)^yi.shrSH(e,r,7),i=yi.rotrSL(e,r,1)^yi.rotrSL(e,r,8)^yi.shrSL(e,r,7),o=0|bi[t-2],s=0|mi[t-2],a=yi.rotrSH(o,s,19)^yi.rotrBH(o,s,61)^yi.shrSH(o,s,6),u=yi.rotrSL(o,s,19)^yi.rotrBL(o,s,61)^yi.shrSL(o,s,6),c=yi.add4L(i,u,mi[t-7],mi[t-16]),f=yi.add4H(c,n,a,bi[t-7],bi[t-16]);bi[t]=0|f,mi[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:f,El:h,Fh:d,Fl:l,Gh:p,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=yi.rotrSH(f,h,14)^yi.rotrSH(f,h,18)^yi.rotrBH(f,h,41),b=yi.rotrSL(f,h,14)^yi.rotrSL(f,h,18)^yi.rotrBL(f,h,41),m=f&d^~f&p,v=h&l^~h&y,E=yi.add5L(w,b,v,wi[t],mi[t]),A=yi.add5H(E,g,e,m,gi[t],bi[t]),B=0|E,I=yi.rotrSH(r,n,28)^yi.rotrBH(r,n,34)^yi.rotrBH(r,n,39),S=yi.rotrSL(r,n,28)^yi.rotrBL(r,n,34)^yi.rotrBL(r,n,39),x=r&i^r&s^i&s,k=n&o^n&a^o&a;g=0|p,w=0|y,p=0|d,y=0|l,d=0|f,l=0|h,({h:f,l:h}=yi.add(0|u,0|c,0|A,0|B)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const R=yi.add3L(B,S,k);r=yi.add3H(R,A,I,x),n=0|R}({h:r,l:n}=yi.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=yi.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=yi.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=yi.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l:h}=yi.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:l}=yi.add(0|this.Fh,0|this.Fl,0|d,0|l)),({h:p,l:y}=yi.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:w}=yi.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,i,o,s,a,u,c,f,h,d,l,p,y,g,w)}roundClean(){bi.fill(0),mi.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 Ei=ke((()=>new vi));
|
|
12
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const
|
|
13
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const
|
|
10
|
+
!function(t){const e=a,r=y,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(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 u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|p(t,e);let n=o(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){const e=new Uint8Array(t);return d(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(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return d(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 s.from(n,e,r);const i=function(t){if(s.isBuffer(t)){const e=0|l(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||$(t.length)?o(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.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 c(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 c(t),o(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(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,s.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 p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(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 i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!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 U(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(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,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){let o,s=1,a=t.length,u=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,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(t,o+n)!==c(e,n)){r=!1;break}if(r)return o}return-1}function v(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if($(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return Y(q(e,t.length-r),t,r,n)}function A(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 B(t,e,r,n){return Y(X(e),t,r,n)}function I(t,e,r,n){return Y(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(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 x(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}t.kMaxLength=i,s.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}}(),s.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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},s.allocUnsafe=function(t){return f(t)},s.allocUnsafeSlow=function(t){return f(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.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 i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Z(e,Uint8Array))i+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.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},s.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},s.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},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):g.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.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&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.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===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r);for(let t=0;t<u;++t)if(c[t]!==f[t]){o=c[t],a=f[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},s.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 i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!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 A(this,t,e,r);case"base64":return B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function _(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function U(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=K[t[n]];return i}function L(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function P(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 T(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)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,i){F(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;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 N(t,e,r,n,i){F(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;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 O(t,e,r,n,i,o){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,i,o){return e=+e,n>>>=0,o||O(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function W(t,e,n,i,o){return e=+e,n>>>=0,o||O(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.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,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(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)})),s.prototype.readBigInt64BE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(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)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Q((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(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},s.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Q((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return W(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return W(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.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 i=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),i},s.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&&!s.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 i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=s.isBuffer(t)?t:s.from(t,n),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%a]}return this};const z={};function M(t,e,r){z[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 j(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 F(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(n,i,o)}function V(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw V(t,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}M("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),M("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),M("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(s);const g=new t("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const w=new t("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t("So11111111111111111111111111111111111111112"),new t("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.s16=b.s8=b.nu64be=b.u48be=b.u40be=b.u32be=b.u24be=b.u16be=b.nu64=b.u48=b.u40=nt=b.u32=b.u24=b.u16=rt=b.u8=b.offset=b.greedy=b.Constant=b.UTF8=b.CString=b.Blob=b.Boolean=b.BitField=b.BitStructure=b.VariantLayout=b.Union=b.UnionLayoutDiscriminator=b.UnionDiscriminator=b.Structure=b.Sequence=b.DoubleBE=b.Double=b.FloatBE=b.Float=b.NearInt64BE=b.NearInt64=b.NearUInt64BE=b.NearUInt64=b.IntBE=b.Int=b.UIntBE=b.UInt=b.OffsetLayout=b.GreedyCount=b.ExternalLayout=b.bindConstructorLayout=b.nameWithProperty=b.Layout=b.uint8ArrayToBuffer=b.checkUint8Array=void 0,b.constant=b.utf8=b.cstr=ot=b.blob=b.unionLayoutDiscriminator=b.union=b.seq=b.bits=it=b.struct=b.f64be=b.f64=b.f32be=b.f32=b.ns64be=b.s48be=b.s40be=b.s32be=b.s24be=b.s16be=b.ns64=b.s48=b.s40=b.s32=b.s24=void 0;const m=s;function v(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function E(t){return v(t),m.Buffer.from(t.buffer,t.byteOffset,t.length)}b.checkUint8Array=v,b.uint8ArrayToBuffer=E;class A{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 B(t,e){return e.property?t+"["+e.property+"]":t}b.Layout=A,b.nameWithProperty=B,b.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 A))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 I extends A{isCount(){throw new Error("ExternalLayout is abstract")}}b.ExternalLayout=I;class S extends I{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){v(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}b.GreedyCount=S;class x extends I{constructor(t,e=0,r){if(!(t instanceof A))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 k||this.layout instanceof R}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)}}b.OffsetLayout=x;class k extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntLE(t,r,this.span),this.span}}b.UInt=k;class R extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntBE(t,r,this.span),this.span}}b.UIntBE=R;class _ extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeIntLE(t,r,this.span),this.span}}b.Int=_;class U extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeIntBE(t,r,this.span),this.span}}b.IntBE=U;const L=Math.pow(2,32);function P(t){const e=Math.floor(t/L);return{hi32:e,lo32:t-e*L}}function T(t,e){return t*L+e}class C extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}b.NearUInt64=C;class N extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearUInt64BE=N;class O extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}b.NearInt64=O;class D extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearInt64BE=D;class W extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatLE(e)}encode(t,e,r=0){return E(e).writeFloatLE(t,r),4}}b.Float=W;class z extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatBE(e)}encode(t,e,r=0){return E(e).writeFloatBE(t,r),4}}b.FloatBE=z;class M extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleLE(e)}encode(t,e,r=0){return E(e).writeDoubleLE(t,r),8}}b.Double=M;class j extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleBE(e)}encode(t,e,r=0){return E(e).writeDoubleBE(t,r),8}}b.DoubleBE=j;class F extends A{constructor(t,e,r){if(!(t instanceof A))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof I&&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 I)&&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 I&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t,e=0){const r=[];let n=0,i=this.count;for(i instanceof I&&(i=i.decode(t,e));n<i;)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,i=t.reduce(((t,i)=>t+n.encode(i,e,r+t)),0);return this.count instanceof I&&this.count.encode(t.length,e,r),i}}b.Sequence=F;class V extends A{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof A),!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 i=n.getSpan(t,e);return e+=i,r+i}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){v(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 i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-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)}}}b.Structure=V;class H{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}b.UnionDiscriminator=H;class G extends H{constructor(t,e){if(!(t instanceof I&&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)}}b.UnionLayoutDiscriminator=G;class q extends A{constructor(t,e,r){let n;if(t instanceof k||t instanceof R)n=new G(new x(t));else if(t instanceof I&&t.isCount())n=new G(t);else{if(!(t instanceof H))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 A))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 i=-1;e&&(i=e.span,0<=i&&(t instanceof k||t instanceof R)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof k||t instanceof R,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=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,i=n.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=i,r[o.property]=o.decode(t,e+s)}else r=o.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(t[n.property],e,r),o+i.encode(t[i.property],e,r+o)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new X(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]}}b.Union=q;class X extends A{constructor(t,e,r,n){if(!(t instanceof q))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 A))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 i=t.span;0>t.span&&(i=r?r.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,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 i=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),i+=this.layout.getSpan(e,r+n),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Y(t){return 0>t&&(t+=4294967296),t}b.VariantLayout=X;class Z extends A{constructor(t,e,r){if(!(t instanceof k||t instanceof R))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=Y(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 $(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new K(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}}b.BitStructure=Z;class ${constructor(t,e,r){if(!(t instanceof Z))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,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>n)throw new Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-e),this.wordMask=Y(this.valueMask<<this.start),this.property=r}decode(t,e){return Y(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==Y(t&this.valueMask))throw new TypeError(B("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=Y(t<<this.start);this.container._packedSetValue(Y(e&~this.wordMask)|r)}}b.BitField=$;class K extends ${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)}}b.Boolean=K;class Q extends A{constructor(t,e){if(!(t instanceof I&&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 I||(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)),E(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof I&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(B("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=E(t);return E(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof I&&this.length.encode(n,e,r),n}}b.Blob=Q;class J extends A{constructor(t){super(-1,t)}getSpan(t,e=0){v(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 E(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(r+i>e.length)throw new RangeError("encoding overruns Buffer");const o=E(e);return n.copy(o,r),o[r+i]=0,i+1}}b.CString=J;class tt extends A{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 v(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 E(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(r+i>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(E(e),r),i}}b.UTF8=tt;class et extends A{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}b.Constant=et,b.greedy=(t,e)=>new S(t,e),b.offset=(t,e,r)=>new x(t,e,r);var rt=b.u8=t=>new k(1,t);b.u16=t=>new k(2,t),b.u24=t=>new k(3,t);var nt=b.u32=t=>new k(4,t);b.u40=t=>new k(5,t),b.u48=t=>new k(6,t),b.nu64=t=>new C(t),b.u16be=t=>new R(2,t),b.u24be=t=>new R(3,t),b.u32be=t=>new R(4,t),b.u40be=t=>new R(5,t),b.u48be=t=>new R(6,t),b.nu64be=t=>new N(t),b.s8=t=>new _(1,t),b.s16=t=>new _(2,t),b.s24=t=>new _(3,t),b.s32=t=>new _(4,t),b.s40=t=>new _(5,t),b.s48=t=>new _(6,t),b.ns64=t=>new O(t),b.s16be=t=>new U(2,t),b.s24be=t=>new U(3,t),b.s32be=t=>new U(4,t),b.s40be=t=>new U(5,t),b.s48be=t=>new U(6,t),b.ns64be=t=>new D(t),b.f32=t=>new W(t),b.f32be=t=>new z(t),b.f64=t=>new M(t),b.f64be=t=>new j(t);var it=b.struct=(t,e,r)=>new V(t,e,r);b.bits=(t,e,r)=>new Z(t,e,r),b.seq=(t,e,r)=>new F(t,e,r),b.union=(t,e,r)=>new q(t,e,r),b.unionLayoutDiscriminator=(t,e)=>new G(t,e);var ot=b.blob=(t,e)=>new Q(t,e);b.cstr=t=>new J(t),b.utf8=(t,e)=>new tt(t,e),b.constant=(t,e)=>new et(t,e);const st=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var at={};Object.defineProperty(at,"__esModule",{value:!0});var ut=at.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};at.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var ct=at.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}};at.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const ft=(ht=8,t=>{const e=ot(ht,t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>{const r=n(t,e);return ut(Buffer.from(r))},i.encode=(t,e,n)=>{const i=ct(t,ht);return r(i,e,n)},i});var ht;const dt=t=>{const e=rt(t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>!!n(t,e),i.encode=(t,e,n)=>{const i=Number(t);return r(i,e,n)},i},lt=e=>{const r=ot(32,e),{encode:n,decode:i}=st(r),o=r;return o.decode=(e,r)=>{const n=i(e,r);return new t(n)},o.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},o};class pt extends Error{constructor(t){super(t)}}class yt extends pt{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class gt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class wt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class bt extends pt{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class mt extends pt{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(vt||(vt={}));const Et=1,At=it([rt("m"),rt("n"),dt("isInitialized"),lt("signer1"),lt("signer2"),lt("signer3"),lt("signer4"),lt("signer5"),lt("signer6"),lt("signer7"),lt("signer8"),lt("signer9"),lt("signer10"),lt("signer11")]).span;var Bt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(Bt||(Bt={}));const It=it([lt("mint"),lt("owner"),ft("amount"),nt("delegateOption"),lt("delegate"),rt("state"),nt("isNativeOption"),ft("isNative"),ft("delegatedAmount"),nt("closeAuthorityOption"),lt("closeAuthority")]),St=It.span,xt=it([nt("mintAuthorityOption"),lt("mintAuthority"),ft("supply"),rt("decimals"),dt("isInitialized"),nt("freezeAuthorityOption"),lt("freezeAuthority")]),kt=xt.span;async function Rt(t,e,r,n=g){return function(t,e,r=g){if(!e)throw new yt;if(!e.owner.equals(r))throw new gt;if(e.data.length<kt)throw new wt;const n=xt.decode(e.data.slice(0,kt));let i=Buffer.alloc(0);if(e.data.length>kt){if(e.data.length<=St)throw new wt;if(e.data.length===At)throw new wt;if(e.data[St]!=vt.Mint)throw new bt;i=e.data.slice(St+Et)}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:i}}(e,await t.getAccountInfo(e,r),n)}function _t(e,r,n=!1,i=g,o=w){if(!n&&!t.isOnCurve(r.toBuffer()))throw new mt;const[s]=t.findProgramAddressSync([r.toBuffer(),i.toBuffer(),e.toBuffer()],o);return s}function Ut(t,n,i,o,s=g,a=w){return function(t,n,i,o,s,a=g,u=w){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new r({keys:c,programId:u,data:s})}(t,n,i,o,Buffer.from([1]),s,a)}var Lt;!function(t){t.SymbolNotFound="SymbolNotFound",t.InvalidSubdomain="InvalidSubdomain",t.FavouriteDomainNotFound="FavouriteDomainNotFound",t.MissingParentOwner="MissingParentOwner",t.U32Overflow="U32Overflow",t.InvalidBufferLength="InvalidBufferLength",t.U64Overflow="U64Overflow",t.NoRecordData="NoRecordData",t.InvalidRecordData="InvalidRecordData",t.UnsupportedRecord="UnsupportedRecord",t.InvalidEvmAddress="InvalidEvmAddress",t.InvalidInjectiveAddress="InvalidInjectiveAddress",t.InvalidARecord="InvalidARecord",t.InvalidAAAARecord="InvalidAAAARecord",t.InvalidRecordInput="InvalidRecordInput",t.InvalidSignature="InvalidSignature",t.AccountDoesNotExist="AccountDoesNotExist",t.MultipleRegistries="MultipleRegistries",t.InvalidReverseTwitter="InvalidReverseTwitter",t.NoAccountData="NoAccountData",t.InvalidInput="InvalidInput",t.InvalidDomain="InvalidDomain",t.InvalidCustomBg="InvalidCustomBackground",t.UnsupportedSignature="UnsupportedSignature",t.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",t.RecordIsNotSigned="RecordIsNotSigned",t.UnsupportedSignatureType="UnsupportedSignatureType",t.InvalidSolRecordV2="InvalidSolRecordV2",t.MissingVerifier="MissingVerifier",t.PythFeedNotFound="PythFeedNotFound"}(Lt||(Lt={}));class Pt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,Pt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new Pt(Lt.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 Ct{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new Pt(Lt.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new Ct(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Nt,Ot=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Dt=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 i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](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}(),Wt=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),i=this.view[n](this.offset,!0);return this.offset+=r,i},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}(),zt=(Nt=function(t,e){return Nt=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])},Nt(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}Nt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Mt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function jt(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 Ft=Ot.concat(["bool","string"]),Vt=["option","enum","array","set","map","struct"],Ht=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return zt(e,t),e}(Error);function Gt(t){if("string"!=typeof t||!Ft.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Vt.includes(e[0])){var r=e[0];if("option"===r)return Gt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Ht(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');Gt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Gt(t.type);throw new Ht(t,"{ type, len? }")}(t[r]);if("set"===r)return Gt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Ht(t,"{ key, value }");Gt(t.key),Gt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"object");for(var e in t)Gt(t[e])}(t[r])}}throw new Ht(t,Vt.join(", ")+" or "+Ft.join(", "))}}var qt=function(){function t(t){this.encoded=new Dt,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(Ot.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&&Mt(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),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Mt(t,"string",this.fieldPath);for(var e=t,r=[],n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?r.push(i):i<2048?r.push(192|i>>6,128|63&i):i<55296||i>=57344?r.push(224|i>>12,128|i>>6&63,128|63&i):(n++,i=65536+((1023&i)<<10|1023&e.charCodeAt(n)),r.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}this.encoded.store_value(r.length,"u32"),this.encoded.store_bytes(new Uint8Array(r))},t.prototype.encode_boolean=function(t){this.checkTypes&&Mt(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 i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}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?jt(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?jt(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&&Mt(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,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Mt(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 i=0,o=n;i<o.length;i++){var s=o[i];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&&Mt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),Xt=function(){function t(t){this.buffer=new Wt(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Ot.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)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},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 i=e[n];if(i<128)r.push(i);else if(i<224)r.push((31&i)<<6|63&e[++n]);else if(i<240)r.push((15&i)<<12|(63&e[++n])<<6|63&e[++n]);else{var o=(7&i)<<18|(63&e[++n])<<12|(63&e[++n])<<6|63&e[++n];r.push(o)}}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,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),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 i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}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 Yt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new qt(r).encode(e,t)}function Zt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new Xt(e).decode(t)}function $t(e,n,i,o,a,u,c,f,h,d,l){const p=[s.Buffer.from(Int8Array.from([0])),new Tt(u.length).toBuffer(),u,c.toBuffer(),f.toBuffer()],y=s.Buffer.concat(p),g=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1}];return h?g.push({pubkey:h,isSigner:!0,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d?g.push({pubkey:d,isSigner:!1,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),l&&g.push({pubkey:l,isSigner:!0,isWritable:!1}),new r({keys:g,programId:e,data:y})}function Kt(t,e,n,i,o){const a=[s.Buffer.from(Int8Array.from([1])),n.toBuffer(),new Tt(i.length).toBuffer(),i],u=s.Buffer.concat(a);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:u})}function Qt(e,n,i,o,a,u,c){const f=[s.Buffer.from(Int8Array.from([2])),i.toBuffer()],h=s.Buffer.concat(f),d=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:c||o,isSigner:!0,isWritable:!1}];return a&&d.push({pubkey:a,isSigner:!0,isWritable:!1}),c&&u&&(a||d.push({pubkey:t.default,isSigner:!1,isWritable:!1}),d.push({pubkey:u,isSigner:!1,isWritable:!1})),new r({keys:d,programId:e,data:h})}function Jt(t,e,n,i){const o=[s.Buffer.from(Int8Array.from([3]))],a=s.Buffer.concat(o);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0}],programId:t,data:a})}class te{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Yt(te.schema,this)}getInstruction(t,n,i,o,a,u,c,f,h,d,l){const p=s.Buffer.from(this.serialize()),y=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!0},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:f,isSigner:!0,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:g,isSigner:!1,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!1}];return new r({keys:y,programId:t,data:p})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(t){this.tag=12,this.name=t.name}serialize(){return Yt(ee.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!1}),l.push({pubkey:a,isSigner:!1,isWritable:!1}),l.push({pubkey:u,isSigner:!0,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),f&&l.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&l.push({pubkey:h,isSigner:!0,isWritable:!0}),new r({keys:l,programId:t,data:d})}}ee.schema={struct:{tag:"u8",name:"string"}};class re{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Yt(re.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,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:l,isSigner:!1,isWritable:!1}),v.push({pubkey:p,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 r({keys:v,programId:t,data:m})}}re.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class ne{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Yt(ne.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,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:l,isSigner:!1,isWritable:!0}),v.push({pubkey:p,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 r({keys:v,programId:t,data:m})}}ne.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ie{constructor(){this.tag=16}serialize(){return Yt(ie.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!0}),l.push({pubkey:a,isSigner:!1,isWritable:!0}),l.push({pubkey:u,isSigner:!1,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),l.push({pubkey:f,isSigner:!0,isWritable:!1}),l.push({pubkey:h,isSigner:!1,isWritable:!0}),new r({keys:l,programId:t,data:d})}}function oe(t,e,n,i,o,a){const u=[s.Buffer.from(Int8Array.from([4])),a.toBuffer()],c=s.Buffer.concat(u);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:c})}ie.schema={struct:{tag:"u8"}};class se{constructor(){this.tag=6}serialize(){return Yt(se.schema,this)}getInstruction(t,e,n,i,o){const a=s.Buffer.from(this.serialize());let u=[];return u.push({pubkey:e,isSigner:!1,isWritable:!1}),u.push({pubkey:n,isSigner:!1,isWritable:!0}),u.push({pubkey:i,isSigner:!0,isWritable:!0}),u.push({pubkey:o,isSigner:!1,isWritable:!1}),new r({keys:u,programId:t,data:a})}}se.schema={struct:{tag:"u8"}};class ae{constructor(t){this.tag=20,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Yt(ae.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!1}),v.push({pubkey:h,isSigner:!0,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:l,isSigner:!1,isWritable:!1}),v.push({pubkey:p,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 r({keys:v,programId:t,data:m})}}ae.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};const ue=new t("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ce=s.Buffer.from("tokenized_name"),fe=e=>{const[r]=t.findProgramAddressSync([ce,e.toBuffer()],ue);return r};var he;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(he||(he={}));class de{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t(e.nameAccount),this.owner=new t(e.owner),this.nftMint=new t(e.nftMint)}static deserialize(t){return new de(Zt(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.findProgramAddress([s.Buffer.from("nft_record"),e.toBuffer()],r)}}de.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 le=async(e,r)=>{try{const n=fe(r);if("0"===(await Rt(e,n)).supply.toString())return;const i=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],o=await e.getProgramAccounts(g,{filters:i});if(1!=o.length)return;return new t(o[0].account.data.slice(32,64))}catch{return}},pe=async e=>{const r=await e.getProgramAccounts(ue,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t(e.account.data.slice(66,98))))},ye=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ge=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(ue,{filters:r})})(t,e.mint);if(1===r.length)return de.deserialize(r[0].account.data)},we=async(t,e)=>{const r=[...ye(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(g,{filters:r})).map((t=>It.decode(t.account.data))).map((e=>ge(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class be{constructor(e){this.parentName=new t(e.parentName),this.owner=new t(e.owner),this.class=new t(e.class)}static deserialize(t){const e=new be(Zt(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 Pt(Lt.AccountDoesNotExist);const i=new be(Zt(this.schema,n.data));i.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:i,nftOwner:await le(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new be(Zt(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 me(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 ve(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")}be.HEADER_LEN=96,be.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const Ee="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
|
|
11
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ae(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Be=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ie=(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 Se(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function xe(t){if("string"==typeof t&&(t=Se(t)),!Ae(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class ke{clone(){return this._cloneInto()}}function Re(t){const e=e=>t().update(xe(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class _e extends ke{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=Be(this.buffer)}update(t){ve(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=xe(t)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=Be(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){ve(this),function(t,e){me(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:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Be(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,c[t],i)}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:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const Ue=(t,e,r)=>t&e^~t&r,Le=(t,e,r)=>t&e^t&r^e&r,Pe=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]),Te=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ce=new Uint32Array(64);class Ne extends _e{constructor(){super(64,32,8,!1),this.A=0|Te[0],this.B=0|Te[1],this.C=0|Te[2],this.D=0|Te[3],this.E=0|Te[4],this.F=0|Te[5],this.G=0|Te[6],this.H=0|Te[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Ce[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Ce[t-15],r=Ce[t-2],n=Ie(e,7)^Ie(e,18)^e>>>3,i=Ie(r,17)^Ie(r,19)^r>>>10;Ce[t]=i+Ce[t-7]+n+Ce[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(Ie(s,6)^Ie(s,11)^Ie(s,25))+Ue(s,a,u)+Pe[t]+Ce[t]|0,f=(Ie(r,2)^Ie(r,13)^Ie(r,22))+Le(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Ce.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Oe=Re((()=>new Ne)),De=new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),We="SPL Name Service",ze=new t("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Me=new t("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),je=new t("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Fe=new t("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Ve=new t("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),He=new t("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Ge=new t("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),qe=96,Xe=new t("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),Ye=new t("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Ze=[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new t("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new t("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new t("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ"),new t("XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL")],$e=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ke=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"}]]),Qe=new t("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),Je=new t("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),tr=new t("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),er=new t("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),rr=new t("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),nr=new t("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),ir=new t("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT"),or=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]]]);async function sr(t,e){if(!await t.getAccountInfo(e))throw new Pt(Lt.AccountDoesNotExist);return be.retrieve(t,e)}async function ar(t){const e=We+t,r=Oe(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)}async function ur(e,r,n){const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=await t.findProgramAddress(i,De);return o}async function cr(t,e){const r=await ar(e.toBase58()),n=await ur(r,Ve),{registry:i}=await be.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);const o=i.data.slice(0,4).readUInt32LE(0);return i.data.slice(4,4+o).toString()}async function fr(t,e){let r=[];for(let t of e){const e=await ar(t.toBase58()),n=await ur(e,Ve);r.push(n)}return(await be.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;const e=t.data.slice(0,4).readUInt32LE(0);return t.data.slice(4,4+e).toString()}))}const hr=async(t,e=ze)=>{let r=await ar(t);return{pubkey:await ur(r,void 0,e),hashed:r}},dr=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=s.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:n}=await hr(r[1]);return{...await hr(t,n),isSub:!0,parent:n}}if(3===r.length&&e){const{pubkey:t}=await hr(r[2]),{pubkey:e}=await hr("\0".concat(r[1]),t),n=s.Buffer.from([1]).toString();return{...await hr(n.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new Pt(Lt.InvalidInput);return{...await hr(t,ze),isSub:!1,parent:void 0}},lr=async(t,e)=>{const{pubkey:r,parent:n}=await dr(t),i=await ar(r.toBase58());return await ur(i,Ve,e?n:void 0)};var pr,yr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],gr=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 i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](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}(),wr=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),i=this.view[n](this.offset,!0);return this.offset+=r,i},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}(),br=(pr=function(t,e){return pr=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])},pr(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}pr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function mr(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function vr(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 Er=yr.concat(["bool","string"]),Ar=["option","enum","array","set","map","struct"],Br=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return br(e,t),e}(Error);function Ir(t){if("string"!=typeof t||!Er.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Ar.includes(e[0])){var r=e[0];if("option"===r)return Ir(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Br(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');Ir({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Br(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Ir(t.type);throw new Br(t,"{ type, len? }")}(t[r]);if("set"===r)return Ir(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Br(t,"{ key, value }");Ir(t.key),Ir(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Br(t,"object");for(var e in t)Ir(t[e])}(t[r])}}throw new Br(t,Ar.join(", ")+" or "+Er.join(", "))}}var Sr=function(){function t(t){this.encoded=new gr,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(yr.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&&mr(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),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&mr(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&&mr(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 i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}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?vr(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?vr(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&&mr(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,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&mr(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 i=0,o=n;i<o.length;i++){var s=o[i];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&&mr(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),xr=function(){function t(t){this.buffer=new wr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(yr.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)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},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,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),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 i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}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 kr(t,e,r){return void 0===r&&(r=!0),r&&Ir(t),new Sr(r).encode(e,t)}class Rr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return kr(Rr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Rr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class _r{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return kr(_r.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}_r.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class Ur{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return kr(Ur.schema,this)}getInstruction(t,e,n,i,o,s,a,u,c){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:e,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:i,isSigner:!0,isWritable:!0}),h.push({pubkey:o,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:u,isSigner:!1,isWritable:!1}),h.push({pubkey:c,isSigner:!0,isWritable:!0}),new r({keys:h,programId:t,data:f})}}Ur.schema={struct:{tag:"u8",staleness:"bool"}};class Lr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return kr(Lr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Lr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class Pr{constructor(){this.tag=5}serialize(){return kr(Pr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Pr.schema={struct:{tag:"u8"}};class Tr{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return kr(Tr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Tr.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const Cr=new t("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Nr]=t.findProgramAddressSync([Cr.toBuffer()],Cr);var Or,Dr;(Dr=Or||(Or={}))[Dr.None=0]="None",Dr[Dr.Solana=1]="Solana",Dr[Dr.Ethereum=2]="Ethereum",Dr[Dr.UnverifiedSolana=3]="UnverifiedSolana";const Wr=t=>{switch(t){case Or.None:return 0;case Or.Ethereum:return 20;case Or.Solana:case Or.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class zr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new zr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&Ir(e),new xr(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))}}zr.LEN=8,zr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Mr{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=zr.deserialize(t.slice(96,96+zr.LEN)),r=t.slice(96+zr.LEN);return new Mr(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=Wr(this.header.stalenessValidation)+Wr(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Wr(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Wr(this.header.stalenessValidation),e=t+Wr(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var jr;!function(t){t.IPFS="IPFS",t.ARWV="ARWV",t.SOL="SOL",t.ETH="ETH",t.BTC="BTC",t.LTC="LTC",t.DOGE="DOGE",t.Email="email",t.Url="url",t.Discord="discord",t.Github="github",t.Reddit="reddit",t.Twitter="twitter",t.Telegram="telegram",t.Pic="pic",t.SHDW="SHDW",t.POINT="POINT",t.BSC="BSC",t.Injective="INJ",t.Backpack="backpack",t.A="A",t.AAAA="AAAA",t.CNAME="CNAME",t.TXT="TXT",t.Background="background"}(jr||(jr={}));const Fr=new Map([[jr.SOL,96],[jr.ETH,20],[jr.BSC,20],[jr.Injective,20],[jr.A,4],[jr.AAAA,16],[jr.Background,32]]);var Vr;!function(t){t[t.V1=1]="V1",t[t.V2=2]="V2"}(Vr||(Vr={}));var Hr="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=",Gr="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",qr=0,Xr=-3;function Yr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Zr(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Yr,this.dtree=new Yr}var $r=new Yr,Kr=new Yr,Qr=new Uint8Array(30),Jr=new Uint16Array(30),tn=new Uint8Array(30),en=new Uint16Array(30),rn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=new Yr,on=new Uint8Array(320);function sn(t,e,r,n){var i,o;for(i=0;i<r;++i)t[i]=0;for(i=0;i<30-r;++i)t[i+r]=i/r|0;for(o=n,i=0;i<30;++i)e[i]=o,o+=1<<t[i]}var an=new Uint16Array(16);function un(t,e,r,n){var i,o;for(i=0;i<16;++i)t.table[i]=0;for(i=0;i<n;++i)t.table[e[r+i]]++;for(t.table[0]=0,o=0,i=0;i<16;++i)an[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[an[e[r+i]]++]=i)}function cn(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function fn(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 hn(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,i=0,o=t.tag;do{n=2*n+(1&o),o>>>=1,++i,r+=e.table[i],n-=e.table[i]}while(n>=0);return t.tag=o,t.bitcount-=i,e.trans[r+n]}function dn(t,e,r){var n,i,o,s,a,u;for(n=fn(t,5,257),i=fn(t,5,1),o=fn(t,4,4),s=0;s<19;++s)on[s]=0;for(s=0;s<o;++s){var c=fn(t,3,0);on[rn[s]]=c}for(un(nn,on,0,19),a=0;a<n+i;){var f=hn(t,nn);switch(f){case 16:var h=on[a-1];for(u=fn(t,2,3);u;--u)on[a++]=h;break;case 17:for(u=fn(t,3,3);u;--u)on[a++]=0;break;case 18:for(u=fn(t,7,11);u;--u)on[a++]=0;break;default:on[a++]=f}}un(e,on,0,n),un(r,on,n,i)}function ln(t,e,r){for(;;){var n,i,o,s,a=hn(t,e);if(256===a)return qr;if(a<256)t.dest[t.destLen++]=a;else for(n=fn(t,Qr[a-=257],Jr[a]),i=hn(t,r),s=o=t.destLen-fn(t,tn[i],en[i]);s<o+n;++s)t.dest[t.destLen++]=t.dest[s]}}function pn(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 Xr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,qr}!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}($r,Kr),sn(Qr,Jr,4,3),sn(tn,en,2,1),Qr[28]=0,Jr[28]=258;var yn=function(t,e){var r,n,i=new Zr(t,e);do{switch(r=cn(i),fn(i,2,0)){case 0:n=pn(i);break;case 1:n=ln(i,$r,Kr);break;case 2:dn(i,i.ltree,i.dtree),n=ln(i,i.ltree,i.dtree);break;default:n=Xr}if(n!==qr)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?"function"==typeof i.dest.slice?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest};const gn=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],wn=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var bn={swap32LE:t=>{gn&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)wn(t,r,r+3),wn(t,r+1,r+2)})(t)}};const mn=yn,{swap32LE:vn}=bn;var En=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=mn(t,new Uint8Array(r)),t=mn(t,new Uint8Array(r)),vn(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]}},An={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,An.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,i="function"==typeof Buffer,o="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(a),c=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(u),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))},l=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},p=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,i,o="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");o+=u[(e=r<<16|n<<8|i)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},g=n?function(t){return btoa(t)}:i?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=i?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,i=t.length;n<i;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?l(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)},A=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},B=function(t,e){return void 0===e&&(e=!1),e?l(A(t)):A(t)},I=function(t){return B(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=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))}},k=function(t){return t.replace(S,x)},R=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,i="",o=0;o<t.length;)e=c[t.charAt(o++)]<<18|c[t.charAt(o++)]<<12|(r=c[t.charAt(o++)])<<6|(n=c[t.charAt(o++)]),i+=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 i},_=r?function(t){return atob(p(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:R,U=i?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(_(t).split("").map((function(t){return t.charCodeAt(0)})))},L=function(t){return U(T(t))},P=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:o?function(t){return o.decode(U(t))}:function(t){return k(_(t))},T=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return P(T(t))},N=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)},O=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},D=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,O(e))};t("fromBase64",(function(){return C(this)})),t("toBase64",(function(t){return B(this,t)})),t("toBase64URI",(function(){return B(this,!0)})),t("toBase64URL",(function(){return B(this,!0)})),t("toUint8Array",(function(){return L(this)}))},W=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,O(e))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},z=function(){D(),W()},M={version:t,VERSION:e,atob:_,atobPolyfill:R,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:B,encode:B,encodeURI:I,encodeURL:I,utob:E,btou:k,decode:C,isValid:N,fromUint8Array:b,toUint8Array:L,extendString:D,extendUint8Array:W,extendBuiltins:z,Base64:{}};return Object.keys(M).forEach((function(t){return M.Base64[t]=M[t]})),M}();const Bn={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},In=Hr,Sn=Gr,xn=En,kn=An.exports.Base64,Rn=new xn(kn.toUint8Array(In)),_n=new xn(kn.toUint8Array(Sn));function Un(t,e){return 0!=(t&e)}const Ln=0,Pn=1,Tn=2;function Cn(t,e){const r=t.length;let n=0,i=Ln;for(let o=e;o+1<r;o++){const r=t[o+0],s=t[o+1];switch(Un(r,Bn.Regional_Indicator)||(n=0),i){case Tn:case Ln:i=Un(r,Bn.Extended_Pictographic)?Pn:Ln;break;case Pn:i=Un(r,Bn.Extend)?Pn:Un(r,Bn.ZWJ)&&Un(s,Bn.Extended_Pictographic)?Tn:Ln}if(!Un(r,Bn.CR)||!Un(s,Bn.LF)){if(Un(r,Bn.Control|Bn.CR|Bn.LF))return o+1-e;if(Un(s,Bn.Control|Bn.CR|Bn.LF))return o+1-e;if(!(Un(r,Bn.L)&&Un(s,Bn.L|Bn.V|Bn.LV|Bn.LVT)||Un(r,Bn.LV|Bn.V)&&Un(s,Bn.V|Bn.T)||Un(r,Bn.LVT|Bn.T)&&Un(s,Bn.T)||Un(s,Bn.Extend|Bn.ZWJ)||Un(s,Bn.SpacingMark)||Un(r,Bn.Prepend)||i===Tn)){if(!Un(r,Bn.Regional_Indicator)||!Un(s,Bn.Regional_Indicator)||n%2!=0)return o+1-e;n++}}}return r-e}var Nn=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const i=t.codePointAt(e);n.push(Rn.get(i)|_n.get(i)),e+=i>65535?2:1,r.push(e)}for(let i=0;i<n.length;){const o=Cn(n,i),s=r[i],a=r[i+o];e.push(t.slice(s,a)),i+=o}return e},On=o(Nn);const Dn=t=>{const e=We+t,r=Oe(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)},Wn=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,De);return o};async function zn(t,e){const r=Dn(e.toBase58()),n=Wn(r,Ve),{registry:i}=await be.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Qn(i.data)}async function Mn(t,e){let r=[];for(let t of e){const e=Dn(t.toBase58()),n=Wn(e,Ve);r.push(n)}return(await be.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Qn(t.data)}))}const jn=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Ve.toBase58()}}],n=await t.getProgramAccounts(De,{filters:r}),i=[{memcmp:{offset:0,bytes:e.toBase58()}}],o=await t.getProgramAccounts(De,{filters:i,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Qn(t.account.data.slice(96))]))),a=[];return o.forEach((t=>{const r=Yn(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},Fn=(t,e=ze,r)=>{let n=Dn(t);return{pubkey:Wn(n,r,e),hashed:n}},Vn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===Vr.V2?Nr:void 0,n=t.split(".");if(2===n.length){const t=s.Buffer.from([e||0]).toString().concat(n[0]),{pubkey:i}=Fn(n[1]);return{...Fn(t,i,r),isSub:!0,parent:i}}if(3===n.length&&e){const{pubkey:t}=Fn(n[2]),{pubkey:i}=Fn("\0".concat(n[1]),t),o=e===Vr.V2?"":"";return{...Fn(o.concat(n[0]),i,r),isSub:!0,parent:t,isSubRecord:!0}}if(n.length>=3)throw new Pt(Lt.InvalidInput);return{...Fn(t,ze),isSub:!1,parent:void 0}};async function Hn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:ze.toBase58()}}];return(await t.getProgramAccounts(De,{filters:r})).map((t=>t.pubkey))}async function Gn(t,e){const r=await Hn(t,e),n=await Mn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))}const qn=async t=>{const e=[{memcmp:{offset:0,bytes:ze.toBase58()}}];return await t.getProgramAccounts(De,{dataSlice:{offset:32,length:32},filters:e})},Xn=(t,e)=>{const{pubkey:r,parent:n}=Vn(t),i=Dn(r.toBase58());return Wn(i,Ve,e?n:void 0)},Yn=(t,e)=>{const r=Dn(t.toBase58());return Wn(r,Ve,e)},Zn=(t,e)=>{if(!t)throw new Pt(e)},$n=async(t,e)=>{const r=await we(t,e),n=await Mn(t,r.map((t=>t.nameAccount)));return n.map(((t,e)=>({key:r[e].nameAccount,mint:r[e].nftMint,reverse:t}))).filter((t=>!!t.reverse))},Kn=t=>{switch(On(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}};function Qn(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}const Jn=(e,r)=>{const n=s.Buffer.alloc(2);return n.writeUint16LE(e),t.findProgramAddressSync([n,s.Buffer.from(r)],ir)};var ti=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 i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),c=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,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=o-1;(0!==f||h<i)&&-1!==d;d--,h++)f+=s*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,r++}for(var l=o-i;l!==o&&0===c[l];)l++;for(var p=new Uint8Array(n+(o-l)),y=n;l!==o;)p[y++]=c[l++];return p}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,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,l=u-1;(0!==h||d<n)&&-1!==l;l--,d++)h+=256*f[l]>>>0,f[l]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var y=a.repeat(r);p<u;++p)y+=t.charAt(f[p]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var ei,ri=ti("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ni={exports:{}};ei=ni,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"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function u(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(o=t.indexOf(":",o+1))>=0;)i++;if("::"===t.substr(0,2)&&i--,"::"===t.substr(-2,2)&&i--,i>e)return null;for(n=e-i,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 c(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),t[o]>>i!=e[o]>>i)return!1;n-=r,o+=1}return!0}function f(t){if(i.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 c(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,i,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],e&&0!==o)return null;8!==o&&(e=!0),t+=o}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(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}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,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}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,i;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(i=f(e[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(i>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(i=f(t[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(i=f(t[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(i>>8&255),r.push(255&i),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 c(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,i;for(let o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],e&&0!==i)return null;16!==i&&(e=!0),t+=i}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,i=-1;for(;r=t.exec(e);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?e:`${e.substring(0,n)}::${e.substring(n+i)}`},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(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}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,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}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,i,o,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return u(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=u(n[1].slice(0,-1)+s,6),e.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return e.parts.push(o[0]<<8|o[1]),e.parts.push(o[2]<<8|o[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,i,o,s;for(i in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,i))for(o=e[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return i;return r},ei.exports?ei.exports=d:t.ipaddr=d}(i);var ii=ni.exports;const oi=2147483647,si=36,ai={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ui=Math.floor,ci=String.fromCharCode;function fi(t){throw new RangeError(ai[t])}const hi=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},di=function(t,e,r){let n=0;for(t=r?ui(t/700):t>>1,t+=ui(t/e);t>455;n+=si)t=ui(t/35);return ui(n+36*t/(t+38))},li=function(t){const e=[],r=t.length;let n=0,i=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)t.charCodeAt(r)>=128&&fi("not-basic"),e.push(t.charCodeAt(r));for(let u=s>0?s+1:0;u<r;){const s=n;for(let e=1,i=si;;i+=si){u>=r&&fi("invalid-input");const s=(a=t.charCodeAt(u++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:si;s>=si&&fi("invalid-input"),s>ui((oi-n)/e)&&fi("overflow"),n+=s*e;const c=i<=o?1:i>=o+26?26:i-o;if(s<c)break;const f=si-c;e>ui(oi/f)&&fi("overflow"),e*=f}const c=e.length+1;o=di(n-s,c,0==s),ui(n/c)>oi-i&&fi("overflow"),i+=ui(n/c),n%=c,e.splice(n++,0,i)}var a;return String.fromCodePoint(...e)},pi=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const i=t.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&i)<<10)+(1023&n)+65536):(e.push(i),r--)}else e.push(i)}return e}(t);const r=t.length;let n=128,i=0,o=72;for(const r of t)r<128&&e.push(ci(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=oi;for(const e of t)e>=n&&e<r&&(r=e);const u=a+1;r-n>ui((oi-i)/u)&&fi("overflow"),i+=(r-n)*u,n=r;for(const r of t)if(r<n&&++i>oi&&fi("overflow"),r===n){let t=i;for(let r=si;;r+=si){const n=r<=o?1:r>=o+26?26:r-o;if(t<n)break;const i=t-n,s=si-n;e.push(ci(hi(n+i%s,0))),t=ui(i/s)}e.push(ci(hi(t,0))),o=di(i,u,a===s),i=0,++a}++i,++n}return e.join("")},yi=BigInt(2**32-1),gi=BigInt(32);function wi(t,e=!1){return e?{h:Number(t&yi),l:Number(t>>gi&yi)}:{h:0|Number(t>>gi&yi),l:0|Number(t&yi)}}const bi={fromBig:wi,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=wi(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<gi|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 i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},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,i)=>e+r+n+i+(t/2**32|0)|0,add5H:(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,add5L:(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0)};var mi=bi;const[vi,Ei]=(()=>mi.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)))))(),Ai=new Uint32Array(80),Bi=new Uint32Array(80);class Ii extends _e{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:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:f,Fl:h,Gh:d,Gl:l,Hh:p,Hl:y}=this;return[t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y]}set(t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)Ai[r]=t.getUint32(e),Bi[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Ai[t-15],r=0|Bi[t-15],n=mi.rotrSH(e,r,1)^mi.rotrSH(e,r,8)^mi.shrSH(e,r,7),i=mi.rotrSL(e,r,1)^mi.rotrSL(e,r,8)^mi.shrSL(e,r,7),o=0|Ai[t-2],s=0|Bi[t-2],a=mi.rotrSH(o,s,19)^mi.rotrBH(o,s,61)^mi.shrSH(o,s,6),u=mi.rotrSL(o,s,19)^mi.rotrBL(o,s,61)^mi.shrSL(o,s,6),c=mi.add4L(i,u,Bi[t-7],Bi[t-16]),f=mi.add4H(c,n,a,Ai[t-7],Ai[t-16]);Ai[t]=0|f,Bi[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:f,El:h,Fh:d,Fl:l,Gh:p,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=mi.rotrSH(f,h,14)^mi.rotrSH(f,h,18)^mi.rotrBH(f,h,41),b=mi.rotrSL(f,h,14)^mi.rotrSL(f,h,18)^mi.rotrBL(f,h,41),m=f&d^~f&p,v=h&l^~h&y,E=mi.add5L(w,b,v,Ei[t],Bi[t]),A=mi.add5H(E,g,e,m,vi[t],Ai[t]),B=0|E,I=mi.rotrSH(r,n,28)^mi.rotrBH(r,n,34)^mi.rotrBH(r,n,39),S=mi.rotrSL(r,n,28)^mi.rotrBL(r,n,34)^mi.rotrBL(r,n,39),x=r&i^r&s^i&s,k=n&o^n&a^o&a;g=0|p,w=0|y,p=0|d,y=0|l,d=0|f,l=0|h,({h:f,l:h}=mi.add(0|u,0|c,0|A,0|B)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const R=mi.add3L(B,S,k);r=mi.add3H(R,A,I,x),n=0|R}({h:r,l:n}=mi.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=mi.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=mi.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=mi.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l:h}=mi.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:l}=mi.add(0|this.Fh,0|this.Fl,0|d,0|l)),({h:p,l:y}=mi.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:w}=mi.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,i,o,s,a,u,c,f,h,d,l,p,y,g,w)}roundClean(){Ai.fill(0),Bi.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 Si=Re((()=>new Ii));
|
|
12
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const xi=BigInt(1),ki=BigInt(2);function Ri(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const _i=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Ui(t){if(!Ri(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=_i[t[r]];return e}function Li(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const Pi={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Ti(t){return t>=Pi._0&&t<=Pi._9?t-Pi._0:t>=Pi._A&&t<=Pi._F?t-(Pi._A-10):t>=Pi._a&&t<=Pi._f?t-(Pi._a-10):void 0}function Ci(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,i=0;e<r;e++,i+=2){const r=Ti(t.charCodeAt(i)),o=Ti(t.charCodeAt(i+1));if(void 0===r||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}n[e]=16*r+o}return n}function Ni(t){if(!Ri(t))throw new Error("Uint8Array expected");return Li(Ui(Uint8Array.from(t).reverse()))}function Oi(t,e){return Ci(t.toString(16).padStart(2*e,"0"))}function Di(t,e){return Oi(t,e).reverse()}function Wi(t,e,r){let n;if("string"==typeof e)try{n=Ci(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!Ri(e))throw new Error(`${t} must be hex string or Uint8Array`);n=Uint8Array.from(e)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function zi(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!Ri(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 i=t[e];r.set(i,n),n+=i.length}return r}const Mi=t=>(ki<<BigInt(t-1))-xi,ji={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||Ri(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 Fi(t,e,r={}){const n=(e,r,n)=>{const i=ji[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=t[e];if(!(n&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), 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
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vi=BigInt(0),Hi=BigInt(1),Gi=BigInt(2),qi=BigInt(3),Xi=BigInt(4),Yi=BigInt(5),Zi=BigInt(8);function $i(t,e){const r=t%e;return r>=Vi?r:e+r}function Ki(t,e,r){if(r<=Vi||e<Vi)throw new Error("Expected power/modulo > 0");if(r===Hi)return Vi;let n=Hi;for(;e>Vi;)e&Hi&&(n=n*t%r),t=t*t%r,e>>=Hi;return n}function Qi(t,e,r){let n=t;for(;e-- >Vi;)n*=n,n%=r;return n}function Ji(t,e){if(t===Vi||e<=Vi)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=$i(t,e),n=e,i=Vi,o=Hi;for(;r!==Vi;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==Hi)throw new Error("invert: does not exist");return $i(i,e)}function to(t){if(t%Xi===qi){const e=(t+Hi)/Xi;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%Zi===Yi){const e=(t-Yi)/Zi;return function(t,r){const n=t.mul(r,Gi),i=t.pow(n,e),o=t.mul(r,i),s=t.mul(t.mul(o,Gi),i),a=t.mul(o,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-Hi)/Gi;let r,n,i;for(r=t-Hi,n=0;r%Gi===Vi;r/=Gi,n++);for(i=Gi;i<t&&Ki(i,e,t)!==t-Hi;i++);if(1===n){const e=(t+Hi)/Xi;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 o=(r+Hi)/Gi;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=n,u=t.pow(t.mul(t.ONE,i),r),c=t.pow(s,o),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(u,Hi<<BigInt(a-e-1));u=t.sqr(r),c=t.mul(c,r),f=t.mul(f,u),a=e}return c}}(t)}BigInt(9),BigInt(16);const eo=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ro(t,e){const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}
|
|
14
14
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
15
|
-
const
|
|
16
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const
|
|
17
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const
|
|
15
|
+
const no=BigInt(0),io=BigInt(1);function oo(t){return Fi(t.Fp,eo.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Fi(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ro(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
|
|
16
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const so=BigInt(0),ao=BigInt(1),uo=BigInt(2),co=BigInt(8),fo={zip215:!0};function ho(t){const e=function(t){const e=oo(t);return Fi(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:r,n:n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=uo<<BigInt(8*a)-ao,f=r.create,h=e.uvRatio||((t,e)=>{try{return{isValid:!0,value:r.sqrt(t*r.inv(e))}}catch(t){return{isValid:!1,value:so}}}),d=e.adjustScalarBytes||(t=>t),l=e.domain||((t,e,r)=>{if(e.length||r)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&so<t,y=(t,e)=>p(t)&&p(e)&&t<e,g=t=>t===so||y(t,c);function w(t,e){if(y(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===so?t:w(t,n)}const m=new Map;function v(t){if(!(t instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(t,e,r,n){if(this.ex=t,this.ey=e,this.ez=r,this.et=n,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(r))throw new Error("z required");if(!g(n))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof E)throw new Error("extended point not allowed");const{x:e,y:r}=t||{};if(!g(e)||!g(r))throw new Error("invalid affine point");return new E(e,r,ao,f(e*r))}static normalizeZ(t){const e=r.invertBatch(t.map((t=>t.ez)));return t.map(((t,r)=>t.toAffine(e[r]))).map(E.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,m.delete(this)}assertValidity(){const{a:t,d:r}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:n,ey:i,ez:o,et:s}=this,a=f(n*n),u=f(i*i),c=f(o*o),h=f(c*c),d=f(a*t);if(f(c*f(d+u))!==f(h+f(r*f(a*u))))throw new Error("bad point: equation left != right (1)");if(f(n*i)!==f(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){v(t);const{ex:e,ey:r,ez:n}=this,{ex:i,ey:o,ez:s}=t,a=f(e*s),u=f(i*n),c=f(r*s),h=f(o*n);return a===u&&c===h}is0(){return this.equals(E.ZERO)}negate(){return new E(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){const{a:t}=e,{ex:r,ey:n,ez:i}=this,o=f(r*r),s=f(n*n),a=f(uo*f(i*i)),u=f(t*o),c=r+n,h=f(f(c*c)-o-s),d=u+s,l=d-a,p=u-s,y=f(h*l),g=f(d*p),w=f(h*p),b=f(l*d);return new E(y,g,b,w)}add(t){v(t);const{a:r,d:n}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:h,et:d}=t;if(r===BigInt(-1)){const t=f((o-i)*(c+u)),e=f((o+i)*(c-u)),r=f(e-t);if(r===so)return this.double();const n=f(s*uo*d),l=f(a*uo*h),p=l+n,y=e+t,g=l-n,w=f(p*r),b=f(y*g),m=f(p*g),v=f(r*y);return new E(w,b,v,m)}const l=f(i*u),p=f(o*c),y=f(a*n*d),g=f(s*h),w=f((i+o)*(u+c)-l-p),b=g-y,m=g+y,A=f(p-r*l),B=f(w*b),I=f(m*A),S=f(w*A),x=f(b*m);return new E(B,I,x,S)}subtract(t){return this.add(t.negate())}wNAF(t){return I.wNAFCached(this,m,t,E.normalizeZ)}multiply(t){const{p:e,f:r}=this.wNAF(w(t,n));return E.normalizeZ([e,r])[0]}multiplyUnsafe(t){let e=b(t);return e===so?B:this.equals(B)||e===ao?this:this.equals(A)?this.wNAF(e).p:I.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(t){const{ex:e,ey:n,ez:i}=this,o=this.is0();null==t&&(t=o?co:r.inv(i));const s=f(e*t),a=f(n*t),u=f(i*t);if(o)return{x:so,y:ao};if(u!==ao)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===ao?this:this.multiplyUnsafe(t)}static fromHex(t,n=!1){const{d:i,a:o}=e,s=r.BYTES,a=(t=Wi("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const d=Ni(a);d===so||w(d,n?c:r.ORDER);const l=f(d*d),p=f(l-ao),y=f(i*l-o);let{isValid:g,value:b}=h(p,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&ao)===ao,v=0!=(128&u);if(!n&&b===so&&v)throw new Error("Point.fromHex: x=0 and x_0=1");return v!==m&&(b=f(-b)),E.fromAffine({x:b,y:d})}static fromPrivateKey(t){return k(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),n=Di(e,r.BYTES);return n[n.length-1]|=t&ao?128:0,n}toHex(){return Ui(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,ao,f(e.Gx*e.Gy)),E.ZERO=new E(so,ao,ao,so);const{BASE:A,ZERO:B}=E,I=function(t,e){const r=(t,e)=>{const r=e.negate();return t?r:e},n=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:r,unsafeLadder(e,r){let n=t.ZERO,i=e;for(;r>no;)r&io&&(n=n.add(i)),i=i.double(),r>>=io;return n},precomputeWindow(t,e){const{windows:r,windowSize:i}=n(e),o=[];let s=t,a=s;for(let t=0;t<r;t++){a=s,o.push(a);for(let t=1;t<i;t++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(e,i,o){const{windows:s,windowSize:a}=n(e);let u=t.ZERO,c=t.BASE;const f=BigInt(2**e-1),h=2**e,d=BigInt(e);for(let t=0;t<s;t++){const e=t*a;let n=Number(o&f);o>>=d,n>a&&(n-=h,o+=io);const s=e,l=e+Math.abs(n)-1,p=t%2!=0,y=n<0;0===n?c=c.add(r(p,i[s])):u=u.add(r(y,i[l]))}return{p:u,f:c}},wNAFCached(t,e,r,n){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,n(o))),this.wNAF(i,o,r)}}}(E,8*a);function S(t){return $i(t,n)}function x(t){return S(Ni(t))}function k(t){const e=a;t=Wi("private key",t,e);const r=Wi("hashed private key",o(t),2*e),n=d(r.slice(0,e)),i=r.slice(e,2*e),s=x(n),u=A.multiply(s),c=u.toRawBytes();return{head:n,prefix:i,scalar:s,point:u,pointBytes:c}}function R(t=new Uint8Array,...e){const r=zi(...e);return x(o(l(r,Wi("context",t),!!i)))}const _=fo;A._setWindowSize(8);return{CURVE:e,getPublicKey:function(t){return k(t).pointBytes},sign:function(t,e,n={}){t=Wi("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=k(e),c=R(n.context,o,t),f=A.multiply(c).toRawBytes(),h=S(c+R(n.context,f,u,t)*s);return b(h),Wi("result",zi(f,Di(h,r.BYTES)),2*a)},verify:function(t,e,n,o=_){const{context:s,zip215:a}=o,u=r.BYTES;t=Wi("signature",t,2*u),e=Wi("message",e),i&&(e=i(e));const c=Ni(t.slice(u,2*u));let f,h,d;try{f=E.fromHex(n,a),h=E.fromHex(t.slice(0,u),a),d=A.multiplyUnsafe(c)}catch(t){return!1}if(!a&&f.isSmallOrder())return!1;const l=R(s,h.toRawBytes(),f.toRawBytes(),e);return h.add(f.multiplyUnsafe(l)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>s(r.BYTES),precompute:(t=8,e=E.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}
|
|
17
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const lo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),po=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const yo=BigInt(1),go=BigInt(2),wo=BigInt(5),bo=BigInt(10),mo=BigInt(20),vo=BigInt(40),Eo=BigInt(80);const Ao=function(t,e,r=!1,n={}){if(t<=Vi)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=ro(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=to(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Mi(i),ZERO:Vi,ONE:Hi,create:e=>$i(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Vi<=e&&e<t},is0:t=>t===Vi,isOdd:t=>(t&Hi)===Hi,neg:e=>$i(-e,t),eql:(t,e)=>t===e,sqr:e=>$i(e*e,t),add:(e,r)=>$i(e+r,t),sub:(e,r)=>$i(e-r,t),mul:(e,r)=>$i(e*r,t),pow:(t,e)=>function(t,e,r){if(r<Vi)throw new Error("Expected power > 0");if(r===Vi)return t.ONE;if(r===Hi)return e;let n=t.ONE,i=e;for(;r>Vi;)r&Hi&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Hi;return n}(a,t,e),div:(e,r)=>$i(e*Ji(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Ji(e,t),sqrt:n.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const r=new Array(e.length),n=e.reduce(((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n))),t.ONE),i=t.inv(n);return e.reduceRight(((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n))),i),r}(a,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?Di(t,o):Oi(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return r?Ni(t):function(t){return Li(Ui(t))}(t)}});return Object.freeze(a)}(lo,void 0,!0),Bo={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ao,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Si,randomBytes:function(t=32){if(Ee&&"function"==typeof Ee.getRandomValues)return Ee.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")},adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const r=lo,n=$i(e*e*e,r),i=function(t){const e=lo,r=t*t%e*t%e,n=Qi(r,go,e)*r%e,i=Qi(n,yo,e)*t%e,o=Qi(i,wo,e)*i%e,s=Qi(o,bo,e)*o%e,a=Qi(s,mo,e)*s%e,u=Qi(a,vo,e)*a%e,c=Qi(u,Eo,e)*u%e,f=Qi(c,Eo,e)*u%e,h=Qi(f,bo,e)*o%e;return{pow_p_5_8:Qi(h,go,e)*t%e,b2:r}}(t*$i(n*n*e,r)).pow_p_5_8;let o=$i(t*n*i,r);const s=$i(e*o*o,r),a=o,u=$i(o*po,r),c=s===t,f=s===$i(-t,r),h=s===$i(-t*po,r);return c&&(o=a),(f||h)&&(o=u),($i(o,r)&Hi)===Hi&&(o=$i(-o,r)),{isValid:c||f,value:o}}},Io=ho(Bo);const So=(Ao.ORDER+BigInt(3))/BigInt(8);
|
|
18
18
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
19
|
-
function Ao(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function Bo(...t){const e=t=>t,r=(t,e)=>r=>t(e(r));return{encode:t.map((t=>t.encode)).reduceRight(r,e),decode:t.map((t=>t.decode)).reduce(r,e)}}function Io(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map((e=>{if(Ao(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]}))},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map((e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const r=t.indexOf(e);if(-1===r)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return r}))}}}function So(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function xo(t,e="="){if(Ao(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;r.length*t%8;)r.push(e);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let n=r.length;if(n*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if(!((n-1)*t%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function ko(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}bo.pow(ho,Eo),bo.sqrt(bo.neg(bo.ONE)),bo.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const r=t.sqrt(e);t.isOdd(r)&&t.neg(r)}(bo,bo.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ro=(t,e)=>e?Ro(e,t%e):t,_o=(t,e)=>t+(e-Ro(t,e));function Uo(t,e,r,n){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(_o(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${_o(e,r)}`);let i=0,o=0;const s=2**r-1,a=[];for(const n of t){if(Ao(n),n>=2**e)throw new Error(`convertRadix2: invalid data word=${n} from=${e}`);if(i=i<<e|n,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)a.push((i>>o-r&s)>>>0);i&=2**o-1}if(i=i<<r-o&s,!n&&o>=e)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&a.push(i>>>0),a}function Lo(t,e=!1){if(Ao(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(_o(8,t)>32||_o(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(r))throw new Error("radix2.encode input should be Uint8Array");return Uo(Array.from(r),8,t,!e)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(Uo(r,t,8,e))}}}function Po(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}Lo(4),Io("0123456789ABCDEF"),So(""),Lo(5),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),xo(5),So(""),Lo(5),Io("0123456789ABCDEFGHIJKLMNOPQRSTUV"),xo(5),So(""),Lo(5),Io("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),So(""),ko((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),Lo(6),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),xo(6),So(""),Lo(6),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),xo(6),So(""),Lo(6),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),So("");const To=Bo(Io("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),So("")),Co=[996825010,642813549,513874426,1027748829,705979059];function Oo(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<Co.length;t++)1==(e>>t&1)&&(r^=Co[t]);return r}function No(t,e,r=1){const n=t.length;let i=1;for(let e=0;e<n;e++){const r=t.charCodeAt(e);if(r<33||r>126)throw new Error(`Invalid prefix (${t})`);i=Oo(i)^r>>5}i=Oo(i);for(let e=0;e<n;e++)i=Oo(i)^31&t.charCodeAt(e);for(let t of e)i=Oo(i)^t;for(let t=0;t<6;t++)i=Oo(i);return i^=r,To.encode(Uo([i%2**30],30,5,!1))}function Do(t){const e="bech32"===t?1:734539939,r=Lo(5),n=r.decode,i=r.encode,o=Po(n);function s(t,r=90){if("string"!=typeof t)throw new Error("bech32.decode input should be string, not "+typeof t);if(t.length<8||!1!==r&&t.length>r)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${r})`);const n=t.toLowerCase();if(t!==n&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(t=n).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=To.decode(s).slice(0,-6),u=No(o,a,e);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${t}: expected "${u}"`);return{prefix:o,words:a}}return{encode:function(t,r,n=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);const i=t.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=t.toLowerCase(),s=No(o,r,e);return`${o}1${To.encode(r)}${s}`},decode:s,decodeToBytes:function(t){const{prefix:e,words:r}=s(t,!1);return{prefix:e,words:r,bytes:n(r)}},decodeUnsafe:Po(s),fromWords:n,fromWordsUnsafe:o,toWords:i}}const Wo=Do("bech32");Lo(4),Io("0123456789abcdef"),So(""),ko((t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));const zo=(t,e,r)=>vo.verify(e,t,r.toBytes()),Mo=(t,e)=>{const{pubkey:r}=Mn(e+"."+t,Mr.V1);return r};async function jo(t,e,r,n){const i=Mo(e,r);let{registry:o}=await we.retrieve(t,i);if(!o.data)throw new Pt(Lt.NoRecordData);if(n)return fs(o,r,i);const s=zr.get(r);return o.data=o.data.slice(0,s),o}async function Vo(t,e,r,n){const i=r.map((t=>Mo(e,t))),o=await we.retrieveBatch(t,i);return n?o.map(((t,n)=>{if(t)return fs(t,r[n],Mo(e,r[n]))})):o}const Fo=async(t,e)=>await jo(t,e,Wr.IPFS,!0),Ho=async(t,e)=>await jo(t,e,Wr.ARWV,!0),Go=async(t,e)=>await jo(t,e,Wr.ETH,!0),qo=async(t,e)=>await jo(t,e,Wr.BTC,!0),$o=async(t,e)=>await jo(t,e,Wr.LTC,!0),Xo=async(t,e)=>await jo(t,e,Wr.DOGE,!0),Yo=async(t,e)=>await jo(t,e,Wr.Email,!0),Zo=async(t,e)=>await jo(t,e,Wr.Url,!0),Ko=async(t,e)=>await jo(t,e,Wr.Discord,!0),Qo=async(t,e)=>await jo(t,e,Wr.Github,!0),Jo=async(t,e)=>await jo(t,e,Wr.Reddit,!0),ts=async(t,e)=>await jo(t,e,Wr.Twitter,!0),es=async(t,e)=>await jo(t,e,Wr.Telegram,!0),rs=async(t,e)=>await jo(t,e,Wr.Pic,!0),ns=async(t,e)=>await jo(t,e,Wr.SHDW,!0),is=async(t,e)=>await jo(t,e,Wr.SOL),os=async(t,e)=>await jo(t,e,Wr.POINT,!0),ss=async(t,e)=>await jo(t,e,Wr.BSC,!0),as=async(t,e)=>await jo(t,e,Wr.Injective,!0),us=async(t,e)=>await jo(t,e,Wr.Backpack,!0),cs=async(t,e)=>await jo(t,e,Wr.Background,!0),fs=(e,r,n)=>{const i=null==e?void 0:e.data;if(!i)return;if(0===i.compare(s.Buffer.alloc(i.length)))return;const o=zr.get(r),a=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!o){const t=i.slice(0,a).toString("utf-8");return r===Wr.CNAME||r===Wr.TXT?ci(t):t}if(r===Wr.SOL){const t=new TextEncoder,r=s.Buffer.concat([i.slice(0,32),n.toBuffer()]),o=t.encode(r.toString("hex"));if(zo(o,i.slice(32,96),e.owner))return Qn.encode(i.slice(0,32))}if(o&&a!==o){const t=i.slice(0,a).toString("utf-8");if(r===Wr.Injective){const e=Wo.decodeToBytes(t);if("inj"===e.prefix&&20===e.bytes.length)return t}else if(r===Wr.BSC||r===Wr.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===s.Buffer.from(r,"hex").length)return t}else if((r===Wr.A||r===Wr.AAAA)&&ti.isValid(t))return t;throw new Pt(Lt.InvalidRecordData)}if(r===Wr.ETH||r===Wr.BSC)return"0x"+i.slice(0,o).toString("hex");if(r===Wr.Injective)return Wo.encode("inj",Wo.toWords(i.slice(0,o)));if(r===Wr.A||r===Wr.AAAA)return ti.fromByteArray([...i.slice(0,o)]).toString();if(r===Wr.Background)return new t(i.slice(0,o)).toString();throw new Pt(Lt.InvalidRecordData)},hs=(e,r)=>{if(!zr.get(r))return r!==Wr.CNAME&&r!==Wr.TXT||(e=fi(e)),s.Buffer.from(e,"utf-8");if(r===Wr.SOL)throw new Pt(Lt.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===Wr.ETH||r===Wr.BSC)return qn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),s.Buffer.from(e.slice(2),"hex");if(r===Wr.Injective){const t=Wo.decodeToBytes(e);return qn("inj"===t.prefix,Lt.InvalidInjectiveAddress),qn(20===t.bytes.length,Lt.InvalidInjectiveAddress),s.Buffer.from(t.bytes)}if(r===Wr.A){const t=ti.parse(e).toByteArray();return qn(4===t.length,Lt.InvalidARecord),s.Buffer.from(t)}if(r===Wr.AAAA){const t=ti.parse(e).toByteArray();return qn(16===t.length,Lt.InvalidAAAARecord),s.Buffer.from(t)}if(r===Wr.Background)return new t(e).toBuffer();throw new Pt(Lt.InvalidRecordInput)},ds=(t,e,r,n)=>{const i=s.Buffer.concat([t.toBuffer(),e.toBuffer()]),o=(new TextEncoder).encode(i.toString("hex")),a=zo(o,n,r);return qn(a,Lt.InvalidSignature),s.Buffer.concat([t.toBuffer(),n])},ls=new Map([[Wr.Url,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[Wr.CNAME,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),ps=new Set([Wr.ETH,Wr.Injective,Wr.BSC]),ys=async(t,e,r,n)=>{var i;const o=vs(r,e),s=await Dr.retrieve(t,o),a=s.getRoAId(),u=ps.has(e)?Tr.Ethereum:Tr.Solana;if(!(n=null!=n?n:null===(i=ls.get(e))||void 0===i?void 0:i.toBuffer()))throw new Pt(Lt.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===u},gs=new Set([Wr.IPFS,Wr.ARWV,Wr.LTC,Wr.DOGE,Wr.Email,Wr.Url,Wr.Discord,Wr.Github,Wr.Reddit,Wr.Twitter,Wr.Telegram,Wr.Pic,Wr.SHDW,Wr.POINT,Wr.Backpack,Wr.TXT,Wr.CNAME,Wr.BTC]),ws=new Set([Wr.ETH,Wr.Injective,Wr.SOL]),bs=(e,r)=>{if(gs.has(r)){const t=e.toString("utf-8");return r===Wr.CNAME||r===Wr.TXT?ci(t):t}if(r===Wr.SOL)return new t(e).toBase58();if(r===Wr.ETH||r===Wr.BSC)return"0x"+e.toString("hex");if(r===Wr.Injective)return Wo.encode("inj",Wo.toWords(e));if(r===Wr.A||r===Wr.AAAA)return ti.fromByteArray([...e]).toString();throw new Pt(Lt.InvalidARecord)},ms=(e,r)=>{if(gs.has(r))return r!==Wr.CNAME&&r!==Wr.TXT||(e=fi(e)),Buffer.from(e,"utf-8");if(r===Wr.SOL)return new t(e).toBuffer();if(r===Wr.ETH||r===Wr.BSC)return qn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===Wr.Injective){const t=Wo.decodeToBytes(e);return qn("inj"===t.prefix,Lt.InvalidInjectiveAddress),qn(20===t.bytes.length,Lt.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===Wr.A){const t=ti.parse(e).toByteArray();return qn(4===t.length,Lt.InvalidARecord),Buffer.from(t)}if(r===Wr.AAAA){const t=ti.parse(e).toByteArray();return qn(16===t.length,Lt.InvalidAAAARecord),Buffer.from(t)}throw new Pt(Lt.InvalidARecord)},vs=(t,e)=>{const{pubkey:r}=Mn(t),n=Cn("".concat(e));return On(n,Pr,r)};async function Es(t,e,r,n={}){const i=vs(e,r),o=await Dr.retrieve(t,i);return n.deserialize?{retrievedRecord:o,deserializedContent:bs(o.getContent(),r)}:{retrievedRecord:o}}async function As(t,e,r,n={}){const i=r.map((t=>vs(e,t))),o=await Dr.retrieveBatch(t,i);return n.deserialize?o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:bs(t.getContent(),r[e])}})):o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))}const Bs=new t("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Is{constructor(e){this.tag=e.tag,this.nameAccount=new t(e.nameAccount)}static deserialize(t){return new Is(Yt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Pt(Lt.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(e,r){return await t.findProgramAddress([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}static getKeySync(e,r){return t.findProgramAddressSync([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}}Is.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};const Ss=async(e,r)=>{const[n]=Is.getKeySync(Bs,new t(r)),i=await Is.retrieve(e,n),o=await Nn(e,i.nameAccount),{registry:s,nftOwner:a}=await we.retrieve(e,i.nameAccount),u=a||s.owner;return{domain:i.nameAccount,reverse:o,stale:!r.equals(u)}},xs=async(e,r)=>{const n=[],i=r.map((t=>Is.getKeySync(Bs,t)[0])),o=(await e.getMultipleAccountsInfo(i)).map((e=>(null==e?void 0:e.data)?Is.deserialize(null==e?void 0:e.data).nameAccount:t.default)),s=o.map((t=>Gn(t))),a=o.map(((t,e)=>_t(ce(t),r[e],!0))),[u,c,f]=await Promise.all([e.getMultipleAccountsInfo(o),e.getMultipleAccountsInfo(s),e.getMultipleAccountsInfo(a)]);for(let e=0;e<r.length;e++){const i=u[e],o=c[e],s=f[e];if(!i||!o){n.push(void 0);continue}if(new t(null==i?void 0:i.data.slice(32,64)).equals(r[e])){n.push(Yn(null==o?void 0:o.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=It.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Yn(null==o?void 0:o.data.slice(96)))}return n};async function ks(t,r,n,i,o,s,a,u){const c=Cn(r),f=On(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await nr(t,u);d=e.owner}return Zt(Ne,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}async function Rs(t,e,r,n,i,o){const s=Cn(e),a=On(s,i,o);let u;u=i||(await we.retrieve(t,a)).registry.owner;return Kt(Ne,a,new Tt(r),n,u)}async function _s(t,e,r,n,i,o){const s=Cn(e),a=On(s,n,i);let u;u=n||(await we.retrieve(t,a)).registry.owner;return Qt(Ne,a,r,u,n,i,o)}async function Us(t,e,r,n,i){const o=Cn(e),s=On(o,n,i);let a;a=n||(await we.retrieve(t,s)).registry.owner;return Jt(Ne,s,r,a)}const Ls=async(r,i,o,s,a,u=$e,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([ze.toBuffer()],ze),h=Cn(i),d=On(h,void 0,We),l=Cn(d.toBase58()),p=On(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],ze),w=Xe.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,Je,!0),E=Ze.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(ze,Ne,We,d,p,e.programId,f,s,a,Ke,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},Ps=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([ze.toBuffer()],ze),c=Cn(r.toBase58()),f=On(c,u,s);return[[],[new ee({name:i}).getInstruction(ze,Ne,We,f,e.programId,u,o,n,s,a)]]},Ts=async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=Mn(e),u=await t.getMinimumBalanceForRentExemption(n+we.HEADER_LEN),c=await ks(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=Hn(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Ps(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},Cs=async(t,r,n,i,o,s)=>{qn(n!==Wr.SOL,Lt.UnsupportedRecord);const{pubkey:a,hashed:u,parent:c}=Mn(`${n}.${r}`,Mr.V1),f=hs(i,n).length,h=await t.getMinimumBalanceForRentExemption(f+we.HEADER_LEN);return Zt(Ne,e.programId,a,o,s,u,new Ct(h),new Tt(f),void 0,c,o)},Os=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Mn(`${r}.${t}`,Mr.V2);if(u&&(a=Mn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Sr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Pr))(o,s,a,i,Ne,"".concat(r),ms(n,r),Lr);return c},Ns=async(t,e,r,n,i,o)=>{qn(r!==Wr.SOL,Lt.UnsupportedRecord);const{pubkey:s}=Mn(`${r}.${e}`,Mr.V1),a=await t.getAccountInfo(s);qn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist);const u=hs(n,r);if((null==a?void 0:a.data.slice(96).length)!==u.length)return[Jt(Ne,s,o,i),await Cs(t,e,r,n,i,o)];return[Kt(Ne,s,new Tt(0),u,i)]},Ds=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Mn(`${r}.${t}`,Mr.V2);if(u&&(a=Mn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Rr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Pr))(o,s,a,i,Ne,"".concat(r),ms(n,r),Lr);return c},Ws=(t,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=Mn(`${r}.${t}`,Mr.V2);if(a&&(s=Mn(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,r,n,i,o,s)=>(new _r).getInstruction(s,e.programId,o,t,i,r,n,Pr))(i,s,n,o,Ne,Lr);return u},zs=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Mn(`${n}.${r}`,Mr.V2);if(c&&(u=Mn(r).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u)=>new kr({staleness:a}).getInstruction(u,e.programId,s,t,r,n,i,Pr,o))(o,a,u,i,s,Ne,t,Lr);return f},Ms=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Mn(`${r}.${t}`,Mr.V2);if(u&&(a=Mn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a)=>new Ur({roaId:Array.from(s.toBuffer())}).getInstruction(a,e.programId,r,t,n,i,o,Pr))(i,Ne,s,a,n,o,Lr);return c},js=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Mn(`${r}.${t}`,Mr.V2);if(c&&(u=Mn(t).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u,c)=>new xr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(u)}).getInstruction(c,e.programId,o,t,r,n,i,Pr))(i,a,u,n,Ne,Tr.Ethereum,o,s,Lr);return f},Vs=async(t,r,n,i,o,s)=>{const{pubkey:a,hashed:u,parent:c}=Mn(`${Wr.SOL}.${r}`,Mr.V1),f=ds(n,a,i,o).length,h=await t.getMinimumBalanceForRentExemption(f+we.HEADER_LEN);return[Zt(Ne,e.programId,a,i,s,u,new Ct(h),new Tt(f),void 0,c,i)]},Fs=async(t,e,r,n,i,o)=>{const{pubkey:s}=Mn(`${Wr.SOL}.${e}`,Mr.V1),a=await t.getAccountInfo(s);if(qn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Jt(Ne,s,o,n),await Vs(t,e,r,n,i,o)];const u=ds(r,s,n,i);return[Kt(Ne,s,new Tt(0),u,n)]},Hs=(r,n,i)=>{const{pubkey:o}=Mn(r),[s]=t.findProgramAddressSync([o.toBuffer()],ze),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],ze);return(new ie).getInstruction(ze,Ne,e.programId,o,Hn(r),a,s,Ve,n,i)},Gs=(r,i,o,s,a,u,c,f,h)=>{const[d]=t.findProgramAddressSync([o.toBuffer()],ze);return new ne({space:i,name:r}).getInstruction(ze,Ne,We,o,s,e.programId,Ve,a,u,c,f,h,er,g,n,d,rr)},qs=async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=Mn(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await we.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await we.retrieve(t,a)).registry.owner);return Qt(Ne,o,r,i,void 0,u,c)},$s=(t,r)=>{const[n]=Is.getKeySync(Bs,r);return[(new se).getInstruction(Bs,t,n,r,e.programId)]};async function Xs(t,r,n,i,o){const s=Cn(r),a=On(s,void 0,He),u=await t.getMinimumBalanceForRentExemption(i+we.HEADER_LEN);let c=[Zt(Ne,e.programId,a,n,o,s,new Ct(u),new Tt(i),void 0,He,Fe)];return c=c.concat(await ia(t,r,a,n,o)),c}async function Ys(t,e,r,n){const i=Cn(t),o=On(i,void 0,He);return[Kt(Ne,o,new Tt(r),n,e)]}async function Zs(t,e,r,n,i){const o=Cn(e),s=On(o,void 0,He);let a=[Qt(Ne,s,n,r,void 0)];return a.push(await Us(t,r.toString(),i,Fe,He)),a=a.concat(await ia(t,e,s,n,i)),a}async function Ks(t,e){const r=Cn(t),n=On(r,void 0,He),i=Cn(e.toString()),o=On(i,Fe,He);return[Jt(Ne,n,e,e),Jt(Ne,o,e,e)]}async function Qs(t){const e=Cn(t);return On(e,void 0,He)}async function Js(t,e){const r=Cn(e),n=On(r,void 0,He),{registry:i}=await we.retrieve(t,n);return i}async function ta(e,r){const n=Cn(r.toString()),i=On(n,Fe,He);let o=await na.retrieve(e,i);return[o.twitterHandle,new t(o.twitterRegistryKey)]}async function ea(e,r){const n=[{memcmp:{offset:0,bytes:He.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Fe.toBase58()}}],i=await e.getProgramAccounts(Ne,{filters:n});for(const e of i)if(e.account.data.length>we.HEADER_LEN+32){const r=e.account.data.slice(we.HEADER_LEN),n=new na(Yt(na.schema,r));return[n.twitterHandle,new t(n.twitterRegistryKey)]}throw new Pt(Lt.AccountDoesNotExist)}async function ra(e,r){const n=[{memcmp:{offset:0,bytes:He.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t(s.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(Ne,{filters:n});if(i.length>1)throw new Pt(Lt.MultipleRegistries);return i[0].account.data.slice(we.HEADER_LEN)}class na{constructor(t){this.twitterRegistryKey=t.twitterRegistryKey,this.twitterHandle=t.twitterHandle}static async retrieve(t,e){let r=await t.getAccountInfo(e,"processed");if(!r)throw new Pt(Lt.InvalidReverseTwitter);return new na(Yt(na.schema,r.data.slice(we.HEADER_LEN)))}}async function ia(t,r,n,i,o){const a=Cn(i.toString()),u=On(a,Fe,He);let c=Xt(na.schema,new na({twitterRegistryKey:n.toBytes(),twitterHandle:r}));return[Zt(Ne,e.programId,u,i,o,a,new Ct(await t.getMinimumBalanceForRentExemption(c.length+we.HEADER_LEN)),new Tt(c.length),Fe,He,Fe),Kt(Ne,u,new Tt(0),s.Buffer.from(c),Fe)]}var oa;na.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},function(t){t.DegenPoet1="DegenPoet#1",t.Rgb0x001="rgb0x00#1"}(oa||(oa={}));const sa=async(t,e)=>{const{pubkey:r}=Mn(e),{registry:n,nftOwner:i}=await we.retrieve(t,r);if(i)return i;try{const r=await ua(t,n.owner,e);if(void 0!==r)return r;return await aa(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},aa=async(e,r,n)=>{const i=Mo(n,Wr.SOL),o=await is(e,n);if(!(null==o?void 0:o.data))throw new Pt(Lt.NoRecordData);const a=new TextEncoder,u=s.Buffer.concat([o.data.slice(0,32),i.toBuffer()]),c=a.encode(u.toString("hex"));if(!zo(c,o.data.slice(32),r))throw new Pt(Lt.InvalidSignature);return new t(o.data.slice(0,32))},ua=async(e,r,n)=>{try{const i=vs(n,Wr.SOL),o=await Dr.retrieve(e,i),s=o.getStalenessId(),a=o.getRoAId(),u=o.getContent();if(0===s.compare(r.toBuffer())&&o.header.stalenessValidation===Tr.Solana&&0===a.compare(u)&&o.header.rightOfAssociationValidation===Tr.Solana)return new t(u)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},ca=new t("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),fa=new t("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),ha=(t,e)=>{const r=Cn(e),n=Cn(t),i=On(n,void 0,tr);return{domainKey:i,bgKey:On(r,void 0,i)}},da=t=>{switch(t){case oa.DegenPoet1:return ca;case oa.Rgb0x001:return fa;default:throw new Pt(Lt.InvalidCustomBg)}},la=async(e,r,n)=>{const i=vs(n,r),{registry:o,nftOwner:s}=await we.retrieve(e,Mn(n).pubkey),a=s||o.owner,u=await Dr.retrieve(e,i),c=u.getStalenessId();return(null==a?void 0:a.equals(new t(c)))&&u.header.stalenessValidation===Tr.Solana},pa={NAME_PROGRAM_ID:new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new t("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new t("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new t("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new t("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1")],TOKENS_SYM_MINT:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU","USDC"],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS","USDT"],["So11111111111111111111111111111111111111112","SOL"],["fidaWCioBQjieRrUQDxxS5Uxmq1CLi2VuVRyv4dEBey","FIDA"],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P","INJ"]]),PYTH_FEEDS:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",{price:"5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7",product:"6NpdXrQEpmDZ3jZKmM2rhdmkd3H6QAk23j2x8bkXcHKA"}],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS",{price:"38xoQ4oeJCBrcVvca2cGk7iV1dAfrmTR1kmhSCJQ8Jto",product:"C5wDxND9E61RZ1wZhaSTWkoA8udumaHnoQY6BBsiaVpn"}],["So11111111111111111111111111111111111111112",{price:"J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix",product:"3Mnn2fX6rQyUsyELYms1sBJyChWofzSNRoqYzvgMVz5E"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"7teETxN9Y8VK6uJxsctHEwST75mKLLwPH1jaFdvTQCpD",product:"5kWV4bhHeZANzg5MWaYCQYEEKHjur5uz1mu5vuLHwiLB"}],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P",{price:"44uRsNnT35kjkscSu59MxRr9CfkLZWf6gny8bWqUbVxE",product:"7UHB783Nh4avW3Yw9yoktf2KjxipU56KPahA51RnCCYE"}]]),PYTH_MAPPING_ACC:new t("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new t("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},ya=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,pa.NAME_PROGRAM_ID);return o},ga=(t,e=pa.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Cn(t);return{pubkey:ya(n,r,e),hashed:n}},wa=t=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const e=t.split(".");if(2===e.length){const t="\0".concat(e[0]),{pubkey:r}=ga(e[1]);return{...ga(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new Pt(Lt.InvalidInput);return{...ga(t,pa.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ba=(t,e)=>{const{pubkey:r,parent:n}=wa(t),i=Cn(r.toBase58());return ya(i,pa.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function ma(t,r,n,i,o,s,a,u){const c=await ir(r),f=await ya(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await nr(t,u);d=e.owner}return Zt(pa.NAME_PROGRAM_ID,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}const va=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([pa.REGISTER_PROGRAM_ID.toBuffer()],pa.REGISTER_PROGRAM_ID),c=await ir(r.toBase58()),f=ya(c,u,s);return[[],[new ee({name:i}).getInstruction(pa.REGISTER_PROGRAM_ID,pa.NAME_PROGRAM_ID,pa.ROOT_DOMAIN_ACCOUNT,f,e.programId,u,o,n,s,a)]]},Ea={utils:{getNameAccountKeySync:ya,reverseLookup:async(t,e)=>{const r=Cn(e.toBase58()),n=ya(r,pa.REVERSE_LOOKUP_CLASS),{registry:i}=await we.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Yn(i.data)},_deriveSync:ga,getDomainKeySync:wa,getReverseKeySync:ba},constants:pa,bindings:{createNameRegistry:ma,updateNameRegistryData:async function(t,e,r,n,i,o){const s=await ir(e),a=ya(s,i,o);let u;return u=i||(await we.retrieve(t,a)).registry.owner,Kt(pa.NAME_PROGRAM_ID,a,new Tt(r),n,u)},transferNameOwnership:async function(t,e,r,n,i,o){const s=await ir(e),a=ya(s,n,i);let u;return u=n||(await we.retrieve(t,a)).registry.owner,Qt(pa.NAME_PROGRAM_ID,a,r,u,n,i,o)},deleteNameRegistry:async function(t,e,r,n,i){const o=await ir(e),s=ya(o,n,i);let a;return a=n||(await we.retrieve(t,s)).registry.owner,Jt(pa.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(r,i,o,s,a,u=pa.USDC_MINT,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([pa.REGISTER_PROGRAM_ID.toBuffer()],pa.REGISTER_PROGRAM_ID),h=Cn(i),d=ya(h,void 0,pa.ROOT_DOMAIN_ACCOUNT),l=Cn(d.toBase58()),p=ya(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],pa.REGISTER_PROGRAM_ID),w=pa.REFERRERS.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,pa.VAULT_OWNER),E=Ea.constants.PYTH_FEEDS.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(pa.REGISTER_PROGRAM_ID,pa.NAME_PROGRAM_ID,pa.ROOT_DOMAIN_ACCOUNT,d,p,e.programId,f,s,a,pa.PYTH_MAPPING_ACC,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},createReverseName:va,createSubdomain:async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=wa(e),u=await t.getMinimumBalanceForRentExemption(n+we.HEADER_LEN),c=await ma(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=ba(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await va(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},burnDomain:(r,n,i)=>{const{pubkey:o}=wa(r),[s]=t.findProgramAddressSync([o.toBuffer()],pa.REGISTER_PROGRAM_ID),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],pa.REGISTER_PROGRAM_ID);return(new ie).getInstruction(pa.REGISTER_PROGRAM_ID,pa.NAME_PROGRAM_ID,e.programId,o,ba(r),a,s,pa.REVERSE_LOOKUP_CLASS,n,i)},transferSubdomain:async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=wa(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await we.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await we.retrieve(t,a)).registry.owner);return Qt(pa.NAME_PROGRAM_ID,o,r,i,void 0,u,c)}}};export{je as BONFIDA_FIDA_BNB,qe as BONFIDA_USDC_BNB,tr as CUSTOM_BG_TLD,oa as CustomBg,ps as ETH_ROA_RECORDS,Lt as ErrorType,Is as FavouriteDomain,ls as GUARDIANS,De as HASH_PREFIX,rr as METAPLEX_ID,Bs as NAME_OFFERS_ID,Ne as NAME_PROGRAM_ID,we as NameRegistryState,Tt as Numberu32,Ct as Numberu64,Ze as PYTH_FEEDS,Me as PYTH_FIDA_PRICE_ACC,Ke as PYTH_MAPPING_ACC,zr as RECORD_V1_SIZE,Xe as REFERRERS,ze as REGISTER_PROGRAM_ID,Ve as REVERSE_LOOKUP_CLASS,We as ROOT_DOMAIN_ACCOUNT,Wr as Record,Mr as RecordVersion,na as ReverseTwitterRegistryState,ws as SELF_SIGNED,Pt as SNSError,Ge as SOL_RECORD_SIG_LEN,Ye as TOKENS_SYM_MINT,He as TWITTER_ROOT_PARENT_REGISTRY_KEY,Fe as TWITTER_VERIFICATION_AUTHORITY,$e as USDC_MINT,gs as UTF8_ENCODED,Je as VAULT_OWNER,Qe as VAULT_OWNER_DEPRECATED,er as WOLVES_COLLECTION_METADATA,Hs as burnDomain,ie as burnInstruction,Ys as changeTwitterRegistryData,Zs as changeVerifiedPubkey,qn as check,zo as checkSolRecord,Zt as createInstruction,re as createInstructionV3,ks as createNameRegistry,Cs as createRecordInstruction,Os as createRecordV2Instruction,ee as createReverseInstruction,Ps as createReverseName,ia as createReverseTwitterRegistry,Vs as createSolRecordInstruction,Ts as createSubdomain,te as createV2Instruction,Xs as createVerifiedTwitterRegistry,ne as createWithNftInstruction,Jt as deleteInstruction,Us as deleteNameRegistry,Ws as deleteRecordV2,Ks as deleteTwitterRegistry,fs as deserializeRecord,bs as deserializeRecordV2Content,Yn as deserializeReverse,Ea as devnet,js as ethValidateRecordV2Content,Wn as findSubdomains,jn as getAllDomains,Fn as getAllRegisteredDomains,da as getArtistPubkey,Ho as getArweaveRecord,cs as getBackgroundRecord,us as getBackpackRecord,ss as getBscRecord,qo as getBtcRecord,ha as getCustomBgKeys,Ko as getDiscordRecord,Xo as getDogeRecord,cr as getDomainKey,Mn as getDomainKeySync,Vn as getDomainKeysWithReverses,ce as getDomainMint,Xn as getDomainPriceFromName,Yo as getEmailRecord,Go as getEthRecord,Ss as getFavoriteDomain,Qo as getGithubRecord,ta as getHandleAndRegistryKey,ir as getHashedName,Cn as getHashedNameSync,as as getInjectiveRecord,Fo as getIpfsRecord,$o as getLtcRecord,xs as getMultipleFavoriteDomains,As as getMultipleRecordsV2,or as getNameAccountKey,On as getNameAccountKeySync,nr as getNameOwner,rs as getPicRecord,os as getPointRecord,jo as getRecord,Mo as getRecordKeySync,Es as getRecordV2,vs as getRecordV2Key,Vo as getRecords,Jo as getRedditRecord,fr as getReverseKey,Gn as getReverseKeyFromDomainKey,Hn as getReverseKeySync,ns as getShdwRecord,is as getSolRecord,es as getTelegramRecord,$n as getTokenizedDomains,ea as getTwitterHandleandRegistryKeyViaFilters,ts as getTwitterRecord,Js as getTwitterRegistry,ra as getTwitterRegistryData,Qs as getTwitterRegistryKey,Zo as getUrlRecord,sr as performReverseLookup,ar as performReverseLookupBatch,oe as reallocInstruction,Ls as registerDomainName,$s as registerFavorite,se as registerFavoriteInstruction,Gs as registerWithNft,sa as resolve,aa as resolveSolRecordV1,ua as resolveSolRecordV2,de as retrieveNftOwner,le as retrieveNfts,ge as retrieveRecords,Nn as reverseLookup,Dn as reverseLookupBatch,hs as serializeRecord,ms as serializeRecordV2Content,ds as serializeSolRecord,Qt as transferInstruction,_s as transferNameOwnership,qs as transferSubdomain,Kt as updateInstruction,Rs as updateNameRegistryData,Ns as updateRecordInstruction,Ds as updateRecordV2Instruction,Fs as updateSolRecordInstruction,zs as validateRecordV2Content,ys as verifyRightOfAssociation,la as verifyStaleness,Ms as writRoaRecordV2};
|
|
19
|
+
function xo(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function ko(...t){const e=t=>t,r=(t,e)=>r=>t(e(r));return{encode:t.map((t=>t.encode)).reduceRight(r,e),decode:t.map((t=>t.decode)).reduce(r,e)}}function Ro(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map((e=>{if(xo(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]}))},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map((e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const r=t.indexOf(e);if(-1===r)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return r}))}}}function _o(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function Uo(t,e="="){if(xo(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;r.length*t%8;)r.push(e);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let n=r.length;if(n*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if(!((n-1)*t%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function Lo(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}Ao.pow(go,So),Ao.sqrt(Ao.neg(Ao.ONE)),Ao.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const r=t.sqrt(e);t.isOdd(r)&&t.neg(r)}(Ao,Ao.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Po=(t,e)=>e?Po(e,t%e):t,To=(t,e)=>t+(e-Po(t,e));function Co(t,e,r,n){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(To(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${To(e,r)}`);let i=0,o=0;const s=2**r-1,a=[];for(const n of t){if(xo(n),n>=2**e)throw new Error(`convertRadix2: invalid data word=${n} from=${e}`);if(i=i<<e|n,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)a.push((i>>o-r&s)>>>0);i&=2**o-1}if(i=i<<r-o&s,!n&&o>=e)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&a.push(i>>>0),a}function No(t,e=!1){if(xo(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(To(8,t)>32||To(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(r))throw new Error("radix2.encode input should be Uint8Array");return Co(Array.from(r),8,t,!e)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(Co(r,t,8,e))}}}function Oo(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}No(4),Ro("0123456789ABCDEF"),_o(""),No(5),Ro("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Uo(5),_o(""),No(5),Ro("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Uo(5),_o(""),No(5),Ro("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),_o(""),Lo((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),No(6),Ro("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Uo(6),_o(""),No(6),Ro("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Uo(6),_o(""),No(6),Ro("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),_o("");const Do=ko(Ro("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),_o("")),Wo=[996825010,642813549,513874426,1027748829,705979059];function zo(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<Wo.length;t++)1==(e>>t&1)&&(r^=Wo[t]);return r}function Mo(t,e,r=1){const n=t.length;let i=1;for(let e=0;e<n;e++){const r=t.charCodeAt(e);if(r<33||r>126)throw new Error(`Invalid prefix (${t})`);i=zo(i)^r>>5}i=zo(i);for(let e=0;e<n;e++)i=zo(i)^31&t.charCodeAt(e);for(let t of e)i=zo(i)^t;for(let t=0;t<6;t++)i=zo(i);return i^=r,Do.encode(Co([i%2**30],30,5,!1))}function jo(t){const e="bech32"===t?1:734539939,r=No(5),n=r.decode,i=r.encode,o=Oo(n);function s(t,r=90){if("string"!=typeof t)throw new Error("bech32.decode input should be string, not "+typeof t);if(t.length<8||!1!==r&&t.length>r)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${r})`);const n=t.toLowerCase();if(t!==n&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(t=n).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=Do.decode(s).slice(0,-6),u=Mo(o,a,e);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${t}: expected "${u}"`);return{prefix:o,words:a}}return{encode:function(t,r,n=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);const i=t.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=t.toLowerCase(),s=Mo(o,r,e);return`${o}1${Do.encode(r)}${s}`},decode:s,decodeToBytes:function(t){const{prefix:e,words:r}=s(t,!1);return{prefix:e,words:r,bytes:n(r)}},decodeUnsafe:Oo(s),fromWords:n,fromWordsUnsafe:o,toWords:i}}const Fo=jo("bech32");No(4),Ro("0123456789abcdef"),_o(""),Lo((t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));const Vo=(t,e,r)=>Io.verify(e,t,r.toBytes()),Ho=(t,e)=>{const{pubkey:r}=Vn(e+"."+t,Vr.V1);return r};async function Go(t,e,r,n){const i=Ho(e,r);let{registry:o}=await be.retrieve(t,i);if(!o.data)throw new Pt(Lt.NoRecordData);if(n)return ps(o,r,i);const s=Fr.get(r);return o.data=o.data.slice(0,s),o}async function qo(t,e,r,n){const i=r.map((t=>Ho(e,t))),o=await be.retrieveBatch(t,i);return n?o.map(((t,n)=>{if(t)return ps(t,r[n],Ho(e,r[n]))})):o}const Xo=async(t,e)=>await Go(t,e,jr.IPFS,!0),Yo=async(t,e)=>await Go(t,e,jr.ARWV,!0),Zo=async(t,e)=>await Go(t,e,jr.ETH,!0),$o=async(t,e)=>await Go(t,e,jr.BTC,!0),Ko=async(t,e)=>await Go(t,e,jr.LTC,!0),Qo=async(t,e)=>await Go(t,e,jr.DOGE,!0),Jo=async(t,e)=>await Go(t,e,jr.Email,!0),ts=async(t,e)=>await Go(t,e,jr.Url,!0),es=async(t,e)=>await Go(t,e,jr.Discord,!0),rs=async(t,e)=>await Go(t,e,jr.Github,!0),ns=async(t,e)=>await Go(t,e,jr.Reddit,!0),is=async(t,e)=>await Go(t,e,jr.Twitter,!0),os=async(t,e)=>await Go(t,e,jr.Telegram,!0),ss=async(t,e)=>await Go(t,e,jr.Pic,!0),as=async(t,e)=>await Go(t,e,jr.SHDW,!0),us=async(t,e)=>await Go(t,e,jr.SOL),cs=async(t,e)=>await Go(t,e,jr.POINT,!0),fs=async(t,e)=>await Go(t,e,jr.BSC,!0),hs=async(t,e)=>await Go(t,e,jr.Injective,!0),ds=async(t,e)=>await Go(t,e,jr.Backpack,!0),ls=async(t,e)=>await Go(t,e,jr.Background,!0),ps=(e,r,n)=>{const i=null==e?void 0:e.data;if(!i)return;if(0===i.compare(s.Buffer.alloc(i.length)))return;const o=Fr.get(r),a=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!o){const t=i.slice(0,a).toString("utf-8");return r===jr.CNAME||r===jr.TXT?li(t):t}if(r===jr.SOL){const t=new TextEncoder,r=s.Buffer.concat([i.slice(0,32),n.toBuffer()]),o=t.encode(r.toString("hex"));if(Vo(o,i.slice(32,96),e.owner))return ri.encode(i.slice(0,32))}if(o&&a!==o){const t=i.slice(0,a).toString("utf-8");if(r===jr.Injective){const e=Fo.decodeToBytes(t);if("inj"===e.prefix&&20===e.bytes.length)return t}else if(r===jr.BSC||r===jr.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===s.Buffer.from(r,"hex").length)return t}else if((r===jr.A||r===jr.AAAA)&&ii.isValid(t))return t;throw new Pt(Lt.InvalidRecordData)}if(r===jr.ETH||r===jr.BSC)return"0x"+i.slice(0,o).toString("hex");if(r===jr.Injective)return Fo.encode("inj",Fo.toWords(i.slice(0,o)));if(r===jr.A||r===jr.AAAA)return ii.fromByteArray([...i.slice(0,o)]).toString();if(r===jr.Background)return new t(i.slice(0,o)).toString();throw new Pt(Lt.InvalidRecordData)},ys=(e,r)=>{if(!Fr.get(r))return r!==jr.CNAME&&r!==jr.TXT||(e=pi(e)),s.Buffer.from(e,"utf-8");if(r===jr.SOL)throw new Pt(Lt.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===jr.ETH||r===jr.BSC)return Zn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),s.Buffer.from(e.slice(2),"hex");if(r===jr.Injective){const t=Fo.decodeToBytes(e);return Zn("inj"===t.prefix,Lt.InvalidInjectiveAddress),Zn(20===t.bytes.length,Lt.InvalidInjectiveAddress),s.Buffer.from(t.bytes)}if(r===jr.A){const t=ii.parse(e).toByteArray();return Zn(4===t.length,Lt.InvalidARecord),s.Buffer.from(t)}if(r===jr.AAAA){const t=ii.parse(e).toByteArray();return Zn(16===t.length,Lt.InvalidAAAARecord),s.Buffer.from(t)}if(r===jr.Background)return new t(e).toBuffer();throw new Pt(Lt.InvalidRecordInput)},gs=(t,e,r,n)=>{const i=s.Buffer.concat([t.toBuffer(),e.toBuffer()]),o=(new TextEncoder).encode(i.toString("hex")),a=Vo(o,n,r);return Zn(a,Lt.InvalidSignature),s.Buffer.concat([t.toBuffer(),n])},ws=new Map([[jr.Url,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[jr.CNAME,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),bs=new Set([jr.ETH,jr.Injective,jr.BSC]),ms=async(t,e,r,n)=>{var i;const o=Is(r,e),s=await Mr.retrieve(t,o),a=s.getRoAId(),u=bs.has(e)?Or.Ethereum:Or.Solana;if(!(n=null!=n?n:null===(i=ws.get(e))||void 0===i?void 0:i.toBuffer()))throw new Pt(Lt.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===u},vs=new Set([jr.IPFS,jr.ARWV,jr.LTC,jr.DOGE,jr.Email,jr.Url,jr.Discord,jr.Github,jr.Reddit,jr.Twitter,jr.Telegram,jr.Pic,jr.SHDW,jr.POINT,jr.Backpack,jr.TXT,jr.CNAME,jr.BTC]),Es=new Set([jr.ETH,jr.Injective,jr.SOL]),As=(e,r)=>{if(vs.has(r)){const t=e.toString("utf-8");return r===jr.CNAME||r===jr.TXT?li(t):t}if(r===jr.SOL)return new t(e).toBase58();if(r===jr.ETH||r===jr.BSC)return"0x"+e.toString("hex");if(r===jr.Injective)return Fo.encode("inj",Fo.toWords(e));if(r===jr.A||r===jr.AAAA)return ii.fromByteArray([...e]).toString();throw new Pt(Lt.InvalidARecord)},Bs=(e,r)=>{if(vs.has(r))return r!==jr.CNAME&&r!==jr.TXT||(e=pi(e)),Buffer.from(e,"utf-8");if(r===jr.SOL)return new t(e).toBuffer();if(r===jr.ETH||r===jr.BSC)return Zn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===jr.Injective){const t=Fo.decodeToBytes(e);return Zn("inj"===t.prefix,Lt.InvalidInjectiveAddress),Zn(20===t.bytes.length,Lt.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===jr.A){const t=ii.parse(e).toByteArray();return Zn(4===t.length,Lt.InvalidARecord),Buffer.from(t)}if(r===jr.AAAA){const t=ii.parse(e).toByteArray();return Zn(16===t.length,Lt.InvalidAAAARecord),Buffer.from(t)}throw new Pt(Lt.InvalidARecord)},Is=(t,e)=>{const{pubkey:r}=Vn(t),n=Dn("".concat(e));return Wn(n,Nr,r)};async function Ss(t,e,r,n={}){const i=Is(e,r),o=await Mr.retrieve(t,i);return n.deserialize?{retrievedRecord:o,deserializedContent:As(o.getContent(),r)}:{retrievedRecord:o}}async function xs(t,e,r,n={}){const i=r.map((t=>Is(e,t))),o=await Mr.retrieveBatch(t,i);return n.deserialize?o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:As(t.getContent(),r[e])}})):o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))}const ks=new t("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Rs{constructor(e){this.tag=e.tag,this.nameAccount=new t(e.nameAccount)}static deserialize(t){return new Rs(Zt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Pt(Lt.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(e,r){return await t.findProgramAddress([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}static getKeySync(e,r){return t.findProgramAddressSync([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}}Rs.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};const _s=async(e,r)=>{const[n]=Rs.getKeySync(ks,new t(r)),i=await Rs.retrieve(e,n),o=await zn(e,i.nameAccount),{registry:s,nftOwner:a}=await be.retrieve(e,i.nameAccount),u=a||s.owner;return{domain:i.nameAccount,reverse:o,stale:!r.equals(u)}},Us=async(e,r)=>{const n=[],i=r.map((t=>Rs.getKeySync(ks,t)[0])),o=(await e.getMultipleAccountsInfo(i)).map((e=>(null==e?void 0:e.data)?Rs.deserialize(null==e?void 0:e.data).nameAccount:t.default)),s=o.map((t=>Yn(t))),a=o.map(((t,e)=>_t(fe(t),r[e],!0))),[u,c,f]=await Promise.all([e.getMultipleAccountsInfo(o),e.getMultipleAccountsInfo(s),e.getMultipleAccountsInfo(a)]);for(let e=0;e<r.length;e++){const i=u[e],o=c[e],s=f[e];if(!i||!o){n.push(void 0);continue}if(new t(null==i?void 0:i.data.slice(32,64)).equals(r[e])){n.push(Qn(null==o?void 0:o.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=It.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Qn(null==o?void 0:o.data.slice(96)))}return n};async function Ls(t,r,n,i,o,s,a,u){const c=Dn(r),f=Wn(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await sr(t,u);d=e.owner}return $t(De,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}async function Ps(t,e,r,n,i,o){const s=Dn(e),a=Wn(s,i,o);let u;u=i||(await be.retrieve(t,a)).registry.owner;return Kt(De,a,new Tt(r),n,u)}async function Ts(t,e,r,n,i,o){const s=Dn(e),a=Wn(s,n,i);let u;u=n||(await be.retrieve(t,a)).registry.owner;return Qt(De,a,r,u,n,i,o)}async function Cs(t,e,r,n,i){const o=Dn(e),s=Wn(o,n,i);let a;a=n||(await be.retrieve(t,s)).registry.owner;return Jt(De,s,r,a)}const Ns=async(r,i,o,s,a,u=Ye,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([Me.toBuffer()],Me),h=Dn(i),d=Wn(h,void 0,ze),l=Dn(d.toBase58()),p=Wn(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],Me),w=Ze.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,tr,!0),E=Ke.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(Me,De,ze,d,p,e.programId,f,s,a,Qe,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},Os=async(r,i,o,s,a,u=Ye,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([Me.toBuffer()],Me),h=Dn(i),d=Wn(h,void 0,ze),l=Dn(d.toBase58()),p=Wn(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],Me),w=Ze.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,tr,!0),E=or.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const[A]=Jn(0,E),B=new ae({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(Me,De,ze,d,p,e.programId,f,s,s,s,a,A,v,g,n,y,b);return m.push(B),m},Ds=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([Me.toBuffer()],Me),c=Dn(r.toBase58()),f=Wn(c,u,s);return[[],[new ee({name:i}).getInstruction(Me,De,ze,f,e.programId,u,o,n,s,a)]]},Ws=async(t,e,r,n=2e3,i)=>{const o=[],s=e.split(".")[0];if(!s)throw new Pt(Lt.InvalidSubdomain);const{parent:a,pubkey:u}=Vn(e),c=await t.getMinimumBalanceForRentExemption(n+be.HEADER_LEN),f=await Ls(t,"\0".concat(s),n,i||r,r,c,void 0,a);o.push(f);const h=Xn(e,!0),d=await t.getAccountInfo(h);if(!(null==d?void 0:d.data)){const[,t]=await Ds(u,"\0".concat(s),i||r,a,r);o.push(...t)}return[[],o]},zs=async(t,r,n,i,o,s)=>{Zn(n!==jr.SOL,Lt.UnsupportedRecord);const{pubkey:a,hashed:u,parent:c}=Vn(`${n}.${r}`,Vr.V1),f=ys(i,n).length,h=await t.getMinimumBalanceForRentExemption(f+be.HEADER_LEN);return $t(De,e.programId,a,o,s,u,new Ct(h),new Tt(f),void 0,c,o)},Ms=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Vn(`${r}.${t}`,Vr.V2);if(u&&(a=Vn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Rr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Nr))(o,s,a,i,De,"".concat(r),Bs(n,r),Cr);return c},js=async(t,e,r,n,i,o)=>{Zn(r!==jr.SOL,Lt.UnsupportedRecord);const{pubkey:s}=Vn(`${r}.${e}`,Vr.V1),a=await t.getAccountInfo(s);Zn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist);const u=ys(n,r);if((null==a?void 0:a.data.slice(96).length)!==u.length)return[Jt(De,s,o,i),await zs(t,e,r,n,i,o)];return[Kt(De,s,new Tt(0),u,i)]},Fs=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Vn(`${r}.${t}`,Vr.V2);if(u&&(a=Vn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Lr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Nr))(o,s,a,i,De,"".concat(r),Bs(n,r),Cr);return c},Vs=(t,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=Vn(`${r}.${t}`,Vr.V2);if(a&&(s=Vn(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,r,n,i,o,s)=>(new Pr).getInstruction(s,e.programId,o,t,i,r,n,Nr))(i,s,n,o,De,Cr);return u},Hs=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Vn(`${n}.${r}`,Vr.V2);if(c&&(u=Vn(r).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u)=>new Ur({staleness:a}).getInstruction(u,e.programId,s,t,r,n,i,Nr,o))(o,a,u,i,s,De,t,Cr);return f},Gs=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Vn(`${r}.${t}`,Vr.V2);if(u&&(a=Vn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a)=>new Tr({roaId:Array.from(s.toBuffer())}).getInstruction(a,e.programId,r,t,n,i,o,Nr))(i,De,s,a,n,o,Cr);return c},qs=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Vn(`${r}.${t}`,Vr.V2);if(c&&(u=Vn(t).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u,c)=>new _r({validation:s,signature:Array.from(a),expectedPubkey:Array.from(u)}).getInstruction(c,e.programId,o,t,r,n,i,Nr))(i,a,u,n,De,Or.Ethereum,o,s,Cr);return f},Xs=async(t,r,n,i,o,s)=>{const{pubkey:a,hashed:u,parent:c}=Vn(`${jr.SOL}.${r}`,Vr.V1),f=gs(n,a,i,o).length,h=await t.getMinimumBalanceForRentExemption(f+be.HEADER_LEN);return[$t(De,e.programId,a,i,s,u,new Ct(h),new Tt(f),void 0,c,i)]},Ys=async(t,e,r,n,i,o)=>{const{pubkey:s}=Vn(`${jr.SOL}.${e}`,Vr.V1),a=await t.getAccountInfo(s);if(Zn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Jt(De,s,o,n),await Xs(t,e,r,n,i,o)];const u=gs(r,s,n,i);return[Kt(De,s,new Tt(0),u,n)]},Zs=(r,n,i)=>{const{pubkey:o}=Vn(r),[s]=t.findProgramAddressSync([o.toBuffer()],Me),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Me);return(new ie).getInstruction(Me,De,e.programId,o,Xn(r),a,s,Ve,n,i)},$s=(r,i,o,s,a,u,c,f,h)=>{const[d]=t.findProgramAddressSync([o.toBuffer()],Me);return new ne({space:i,name:r}).getInstruction(Me,De,ze,o,s,e.programId,Ve,a,u,c,f,h,rr,g,n,d,nr)},Ks=async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=Vn(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await be.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await be.retrieve(t,a)).registry.owner);return Qt(De,o,r,i,void 0,u,c)},Qs=(t,r)=>{const[n]=Rs.getKeySync(ks,r);return[(new se).getInstruction(ks,t,n,r,e.programId)]};async function Js(t,r,n,i,o){const s=Dn(r),a=Wn(s,void 0,Ge),u=await t.getMinimumBalanceForRentExemption(i+be.HEADER_LEN);let c=[$t(De,e.programId,a,n,o,s,new Ct(u),new Tt(i),void 0,Ge,He)];return c=c.concat(await ca(t,r,a,n,o)),c}async function ta(t,e,r,n){const i=Dn(t),o=Wn(i,void 0,Ge);return[Kt(De,o,new Tt(r),n,e)]}async function ea(t,e,r,n,i){const o=Dn(e),s=Wn(o,void 0,Ge);let a=[Qt(De,s,n,r,void 0)];return a.push(await Cs(t,r.toString(),i,He,Ge)),a=a.concat(await ca(t,e,s,n,i)),a}async function ra(t,e){const r=Dn(t),n=Wn(r,void 0,Ge),i=Dn(e.toString()),o=Wn(i,He,Ge);return[Jt(De,n,e,e),Jt(De,o,e,e)]}async function na(t){const e=Dn(t);return Wn(e,void 0,Ge)}async function ia(t,e){const r=Dn(e),n=Wn(r,void 0,Ge),{registry:i}=await be.retrieve(t,n);return i}async function oa(e,r){const n=Dn(r.toString()),i=Wn(n,He,Ge);let o=await ua.retrieve(e,i);return[o.twitterHandle,new t(o.twitterRegistryKey)]}async function sa(e,r){const n=[{memcmp:{offset:0,bytes:Ge.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:He.toBase58()}}],i=await e.getProgramAccounts(De,{filters:n});for(const e of i)if(e.account.data.length>be.HEADER_LEN+32){const r=e.account.data.slice(be.HEADER_LEN),n=new ua(Zt(ua.schema,r));return[n.twitterHandle,new t(n.twitterRegistryKey)]}throw new Pt(Lt.AccountDoesNotExist)}async function aa(e,r){const n=[{memcmp:{offset:0,bytes:Ge.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t(s.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(De,{filters:n});if(i.length>1)throw new Pt(Lt.MultipleRegistries);return i[0].account.data.slice(be.HEADER_LEN)}class ua{constructor(t){this.twitterRegistryKey=t.twitterRegistryKey,this.twitterHandle=t.twitterHandle}static async retrieve(t,e){let r=await t.getAccountInfo(e,"processed");if(!r)throw new Pt(Lt.InvalidReverseTwitter);return new ua(Zt(ua.schema,r.data.slice(be.HEADER_LEN)))}}async function ca(t,r,n,i,o){const a=Dn(i.toString()),u=Wn(a,He,Ge);let c=Yt(ua.schema,new ua({twitterRegistryKey:n.toBytes(),twitterHandle:r}));return[$t(De,e.programId,u,i,o,a,new Ct(await t.getMinimumBalanceForRentExemption(c.length+be.HEADER_LEN)),new Tt(c.length),He,Ge,He),Kt(De,u,new Tt(0),s.Buffer.from(c),He)]}var fa;ua.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},function(t){t.DegenPoet1="DegenPoet#1",t.Rgb0x001="rgb0x00#1"}(fa||(fa={}));const ha=async(t,e)=>{const{pubkey:r}=Vn(e),{registry:n,nftOwner:i}=await be.retrieve(t,r);if(i)return i;try{const r=await la(t,n.owner,e);if(void 0!==r)return r;return await da(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},da=async(e,r,n)=>{const i=Ho(n,jr.SOL),o=await us(e,n);if(!(null==o?void 0:o.data))throw new Pt(Lt.NoRecordData);const a=new TextEncoder,u=s.Buffer.concat([o.data.slice(0,32),i.toBuffer()]),c=a.encode(u.toString("hex"));if(!Vo(c,o.data.slice(32),r))throw new Pt(Lt.InvalidSignature);return new t(o.data.slice(0,32))},la=async(e,r,n)=>{try{const i=Is(n,jr.SOL),o=await Mr.retrieve(e,i),s=o.getStalenessId(),a=o.getRoAId(),u=o.getContent();if(0===s.compare(r.toBuffer())&&o.header.stalenessValidation===Or.Solana&&0===a.compare(u)&&o.header.rightOfAssociationValidation===Or.Solana)return new t(u)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},pa=new t("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),ya=new t("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),ga=(t,e)=>{const r=Dn(e),n=Dn(t),i=Wn(n,void 0,er);return{domainKey:i,bgKey:Wn(r,void 0,i)}},wa=t=>{switch(t){case fa.DegenPoet1:return pa;case fa.Rgb0x001:return ya;default:throw new Pt(Lt.InvalidCustomBg)}},ba=async(e,r,n)=>{const i=Is(n,r),{registry:o,nftOwner:s}=await be.retrieve(e,Vn(n).pubkey),a=s||o.owner,u=await Mr.retrieve(e,i),c=u.getStalenessId();return(null==a?void 0:a.equals(new t(c)))&&u.header.stalenessValidation===Or.Solana},ma={NAME_PROGRAM_ID:new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new t("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new t("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new t("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new t("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1")],TOKENS_SYM_MINT:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU","USDC"],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS","USDT"],["So11111111111111111111111111111111111111112","SOL"],["fidaWCioBQjieRrUQDxxS5Uxmq1CLi2VuVRyv4dEBey","FIDA"],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P","INJ"]]),PYTH_FEEDS:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",{price:"5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7",product:"6NpdXrQEpmDZ3jZKmM2rhdmkd3H6QAk23j2x8bkXcHKA"}],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS",{price:"38xoQ4oeJCBrcVvca2cGk7iV1dAfrmTR1kmhSCJQ8Jto",product:"C5wDxND9E61RZ1wZhaSTWkoA8udumaHnoQY6BBsiaVpn"}],["So11111111111111111111111111111111111111112",{price:"J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix",product:"3Mnn2fX6rQyUsyELYms1sBJyChWofzSNRoqYzvgMVz5E"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"7teETxN9Y8VK6uJxsctHEwST75mKLLwPH1jaFdvTQCpD",product:"5kWV4bhHeZANzg5MWaYCQYEEKHjur5uz1mu5vuLHwiLB"}],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P",{price:"44uRsNnT35kjkscSu59MxRr9CfkLZWf6gny8bWqUbVxE",product:"7UHB783Nh4avW3Yw9yoktf2KjxipU56KPahA51RnCCYE"}]]),PYTH_MAPPING_ACC:new t("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new t("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},va=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,ma.NAME_PROGRAM_ID);return o},Ea=(t,e=ma.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Dn(t);return{pubkey:va(n,r,e),hashed:n}},Aa=t=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const e=t.split(".");if(2===e.length){const t="\0".concat(e[0]),{pubkey:r}=Ea(e[1]);return{...Ea(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new Pt(Lt.InvalidInput);return{...Ea(t,ma.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},Ba=(t,e)=>{const{pubkey:r,parent:n}=Aa(t),i=Dn(r.toBase58());return va(i,ma.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function Ia(t,r,n,i,o,s,a,u){const c=await ar(r),f=await va(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await sr(t,u);d=e.owner}return $t(ma.NAME_PROGRAM_ID,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}const Sa=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([ma.REGISTER_PROGRAM_ID.toBuffer()],ma.REGISTER_PROGRAM_ID),c=await ar(r.toBase58()),f=va(c,u,s);return[[],[new ee({name:i}).getInstruction(ma.REGISTER_PROGRAM_ID,ma.NAME_PROGRAM_ID,ma.ROOT_DOMAIN_ACCOUNT,f,e.programId,u,o,n,s,a)]]},xa={utils:{getNameAccountKeySync:va,reverseLookup:async(t,e)=>{const r=Dn(e.toBase58()),n=va(r,ma.REVERSE_LOOKUP_CLASS),{registry:i}=await be.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Qn(i.data)},_deriveSync:Ea,getDomainKeySync:Aa,getReverseKeySync:Ba},constants:ma,bindings:{createNameRegistry:Ia,updateNameRegistryData:async function(t,e,r,n,i,o){const s=await ar(e),a=va(s,i,o);let u;return u=i||(await be.retrieve(t,a)).registry.owner,Kt(ma.NAME_PROGRAM_ID,a,new Tt(r),n,u)},transferNameOwnership:async function(t,e,r,n,i,o){const s=await ar(e),a=va(s,n,i);let u;return u=n||(await be.retrieve(t,a)).registry.owner,Qt(ma.NAME_PROGRAM_ID,a,r,u,n,i,o)},deleteNameRegistry:async function(t,e,r,n,i){const o=await ar(e),s=va(o,n,i);let a;return a=n||(await be.retrieve(t,s)).registry.owner,Jt(ma.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(r,i,o,s,a,u=ma.USDC_MINT,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([ma.REGISTER_PROGRAM_ID.toBuffer()],ma.REGISTER_PROGRAM_ID),h=Dn(i),d=va(h,void 0,ma.ROOT_DOMAIN_ACCOUNT),l=Dn(d.toBase58()),p=va(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],ma.REGISTER_PROGRAM_ID),w=ma.REFERRERS.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,ma.VAULT_OWNER),E=xa.constants.PYTH_FEEDS.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(ma.REGISTER_PROGRAM_ID,ma.NAME_PROGRAM_ID,ma.ROOT_DOMAIN_ACCOUNT,d,p,e.programId,f,s,a,ma.PYTH_MAPPING_ACC,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},createReverseName:Sa,createSubdomain:async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=Aa(e),u=await t.getMinimumBalanceForRentExemption(n+be.HEADER_LEN),c=await Ia(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=Ba(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Sa(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},burnDomain:(r,n,i)=>{const{pubkey:o}=Aa(r),[s]=t.findProgramAddressSync([o.toBuffer()],ma.REGISTER_PROGRAM_ID),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],ma.REGISTER_PROGRAM_ID);return(new ie).getInstruction(ma.REGISTER_PROGRAM_ID,ma.NAME_PROGRAM_ID,e.programId,o,Ba(r),a,s,ma.REVERSE_LOOKUP_CLASS,n,i)},transferSubdomain:async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=Aa(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await be.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await be.retrieve(t,a)).registry.owner);return Qt(ma.NAME_PROGRAM_ID,o,r,i,void 0,u,c)}}};export{Fe as BONFIDA_FIDA_BNB,Xe as BONFIDA_USDC_BNB,er as CUSTOM_BG_TLD,fa as CustomBg,ir as DEFAULT_PYTH_PUSH_PROGRAM,bs as ETH_ROA_RECORDS,Lt as ErrorType,Rs as FavouriteDomain,ws as GUARDIANS,We as HASH_PREFIX,nr as METAPLEX_ID,ks as NAME_OFFERS_ID,De as NAME_PROGRAM_ID,be as NameRegistryState,Tt as Numberu32,Ct as Numberu64,Ke as PYTH_FEEDS,je as PYTH_FIDA_PRICE_ACC,Qe as PYTH_MAPPING_ACC,or as PYTH_PULL_FEEDS,Fr as RECORD_V1_SIZE,Ze as REFERRERS,Me as REGISTER_PROGRAM_ID,Ve as REVERSE_LOOKUP_CLASS,ze as ROOT_DOMAIN_ACCOUNT,jr as Record,Vr as RecordVersion,ua as ReverseTwitterRegistryState,Es as SELF_SIGNED,Pt as SNSError,qe as SOL_RECORD_SIG_LEN,$e as TOKENS_SYM_MINT,Ge as TWITTER_ROOT_PARENT_REGISTRY_KEY,He as TWITTER_VERIFICATION_AUTHORITY,Ye as USDC_MINT,vs as UTF8_ENCODED,tr as VAULT_OWNER,Je as VAULT_OWNER_DEPRECATED,rr as WOLVES_COLLECTION_METADATA,Zs as burnDomain,ie as burnInstruction,ta as changeTwitterRegistryData,ea as changeVerifiedPubkey,Zn as check,Vo as checkSolRecord,$t as createInstruction,re as createInstructionV3,Ls as createNameRegistry,zs as createRecordInstruction,Ms as createRecordV2Instruction,ee as createReverseInstruction,Ds as createReverseName,ca as createReverseTwitterRegistry,Xs as createSolRecordInstruction,ae as createSplitV2Instruction,Ws as createSubdomain,te as createV2Instruction,Js as createVerifiedTwitterRegistry,ne as createWithNftInstruction,Jt as deleteInstruction,Cs as deleteNameRegistry,Vs as deleteRecordV2,ra as deleteTwitterRegistry,ps as deserializeRecord,As as deserializeRecordV2Content,Qn as deserializeReverse,xa as devnet,qs as ethValidateRecordV2Content,jn as findSubdomains,Hn as getAllDomains,qn as getAllRegisteredDomains,wa as getArtistPubkey,Yo as getArweaveRecord,ls as getBackgroundRecord,ds as getBackpackRecord,fs as getBscRecord,$o as getBtcRecord,ga as getCustomBgKeys,es as getDiscordRecord,Qo as getDogeRecord,dr as getDomainKey,Vn as getDomainKeySync,Gn as getDomainKeysWithReverses,fe as getDomainMint,Kn as getDomainPriceFromName,Jo as getEmailRecord,Zo as getEthRecord,_s as getFavoriteDomain,rs as getGithubRecord,oa as getHandleAndRegistryKey,ar as getHashedName,Dn as getHashedNameSync,hs as getInjectiveRecord,Xo as getIpfsRecord,Ko as getLtcRecord,Us as getMultipleFavoriteDomains,xs as getMultipleRecordsV2,ur as getNameAccountKey,Wn as getNameAccountKeySync,sr as getNameOwner,ss as getPicRecord,cs as getPointRecord,Jn as getPythFeedAccountKey,Go as getRecord,Ho as getRecordKeySync,Ss as getRecordV2,Is as getRecordV2Key,qo as getRecords,ns as getRedditRecord,lr as getReverseKey,Yn as getReverseKeyFromDomainKey,Xn as getReverseKeySync,as as getShdwRecord,us as getSolRecord,os as getTelegramRecord,$n as getTokenizedDomains,sa as getTwitterHandleandRegistryKeyViaFilters,is as getTwitterRecord,ia as getTwitterRegistry,aa as getTwitterRegistryData,na as getTwitterRegistryKey,ts as getUrlRecord,cr as performReverseLookup,fr as performReverseLookupBatch,oe as reallocInstruction,Ns as registerDomainName,Os as registerDomainNameV2,Qs as registerFavorite,se as registerFavoriteInstruction,$s as registerWithNft,ha as resolve,da as resolveSolRecordV1,la as resolveSolRecordV2,le as retrieveNftOwner,pe as retrieveNfts,we as retrieveRecords,zn as reverseLookup,Mn as reverseLookupBatch,ys as serializeRecord,Bs as serializeRecordV2Content,gs as serializeSolRecord,Qt as transferInstruction,Ts as transferNameOwnership,Ks as transferSubdomain,Kt as updateInstruction,Ps as updateNameRegistryData,js as updateRecordInstruction,Fs as updateRecordV2Instruction,Ys as updateSolRecordInstruction,Hs as validateRecordV2Content,ms as verifyRightOfAssociation,ba as verifyStaleness,Gs as writRoaRecordV2};
|
|
20
20
|
//# sourceMappingURL=index.mjs.map
|