@bonfida/spl-name-service 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -41,5 +41,5 @@ const AE=BigInt("578960446186580977117854925043439539266349923328202820197287920
41
41
  t.exports=r=function(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var n,i={},o=Object.prototype,s=o.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",h=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(n){f=function(t,e,r){return t[e]=r}}function d(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,o=Object.create(i.prototype),s=new O(n||[]);return a(o,"_invoke",{value:M(t,r,s)}),o}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}i.wrap=d;var y="suspendedStart",g="suspendedYield",m="executing",w="completed",b={};function v(){}function _(){}function E(){}var k={};f(k,c,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(L([])));x&&x!==o&&s.call(x,c)&&(k=x);var A=E.prototype=v.prototype=Object.create(k);function I(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function B(t,r){function n(i,o,a,u){var c=p(t[i],t,o);if("throw"!==c.type){var h=c.arg,l=h.value;return l&&"object"==e(l)&&s.call(l,"__await")?r.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):r.resolve(l).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var i;a(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,i){n(t,e,r,i)}))}return i=i?i.then(o,o):o()}})}function M(t,e,r){var i=y;return function(o,s){if(i===m)throw new Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:n,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=R(a,r);if(u){if(u===b)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===y)throw i=w,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=p(t,e,r);if("normal"===c.type){if(i=r.done?w:g,c.arg===b)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=w,r.method="throw",r.arg=c.arg)}}}function R(t,e){var r=e.method,i=t.iterator[r];if(i===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=n,R(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var o=p(i,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,b;var s=o.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,b):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function L(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i<t.length;)if(s.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}throw new TypeError(e(t)+" is not iterable")}return _.prototype=E,a(A,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:_,configurable:!0}),_.displayName=f(E,l,"GeneratorFunction"),i.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,f(t,l,"GeneratorFunction")),t.prototype=Object.create(A),t},i.awrap=function(t){return{__await:t}},I(B.prototype),f(B.prototype,h,(function(){return this})),i.AsyncIterator=B,i.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var s=new B(d(t,e,r,n),o);return i.isGeneratorFunction(e)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},I(A),f(A,l,"Generator"),f(A,c,(function(){return this})),f(A,"toString",(function(){return"[object Generator]"})),i.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},i.values=L,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return a.type="throw",a.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),b}},i}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}(Cx)),Cx.exports)();Ox=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return Ox}()),n=e((Dx||(Dx=1,function(t){function e(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(i,o){var s=t.apply(r,n);function a(t){e(s,i,o,a,u,"next",t)}function u(t){e(s,i,o,a,u,"throw",t)}a(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(Wx)),Wx.exports)),i=e(zx()),o=e(Kx()),s=e(Jx()),a=e(rA()),u=e(aA()),c=e(hA());function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,u.default)(this,r)}}var l=function(t){(0,a.default)(d,t);var e,u,c,l,f=h(d);function d(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,d);var s=n.autoconnect,a=void 0===s||s,u=n.reconnect,c=void 0===u||u,h=n.reconnect_interval,l=void 0===h?1e3:h,p=n.max_reconnects,y=void 0===p?5:p,g=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(n,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=f.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=r,e.autoconnect=a,e.ready=!1,e.reconnect=c,e.reconnect_timer_id=void 0,e.reconnect_interval=l,e.max_reconnects=y,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,s.default)(d,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,r,n){var o=this;return n||"object"!==(0,i.default)(r)||(n=r,r=null),new Promise((function(i,s){if(!o.ready)return s(new Error("socket not ready"));var a=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:a};o.socket.send(JSON.stringify(u),n,(function(t){if(t)return s(t);o.queue[a]={promise:[i,s]},r&&(o.queue[a].timeout=setTimeout((function(){delete o.queue[a],s(new Error("reply timeout"))}),r))}))}))}},{key:"login",value:(l=(0,n.default)(r.default.mark((function t(e){var n;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(n=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,n.default)(r.default.mark((function t(){return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var r=this;return new Promise((function(n,i){if(!r.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};r.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);n()}))}))}},{key:"subscribe",value:(u=(0,n.default)(r.default.mark((function t(e){var n;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(n=t.sent,"string"!=typeof e||"ok"===n[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+n[e]);case 6:return t.abrupt("return",n);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,n.default)(r.default.mark((function t(e){var n;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(n=t.sent,"string"!=typeof e||"ok"===n[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+n);case 6:return t.abrupt("return",n);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var r=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){r.ready=!0,r.emit("open"),r.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=Buffer.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&r.listeners(e.notification).length){if(!Object.keys(e.params).length)return r.emit(e.notification);var n=[e.notification];if(e.params.constructor===Object)n.push(e.params);else for(var i=0;i<e.params.length;i++)n.push(e.params[i]);return Promise.resolve().then((function(){r.emit.apply(r,n)}))}if(!r.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){r.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&r.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),r.queue[e.id].timeout&&clearTimeout(r.queue[e.id].timeout),e.error?r.queue[e.id].promise[1](e.error):r.queue[e.id].promise[0](e.result),delete r.queue[e.id]})),this.socket.addEventListener("error",(function(t){return r.emit("error",t)})),this.socket.addEventListener("close",(function(n){var i=n.code,o=n.reason;r.ready&&setTimeout((function(){return r.emit("close",i,o)}),0),r.ready=!1,r.socket=void 0,1e3!==i&&(r.current_reconnects++,r.reconnect&&(r.max_reconnects>r.current_reconnects||0===r.max_reconnects)&&(r.reconnect_timer_id=setTimeout((function(){return r._connect(t,e)}),r.reconnect_interval)))}))}}]),d}(dA().EventEmitter);t.default=l}({}),function(t){var e=Ux;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new u(t,e)};var r=e(Kx()),n=e(Jx()),i=e(rA()),o=e(aA()),s=e(hA());function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=(0,s.default)(t);if(e){var i=(0,s.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,o.default)(this,r)}}var u=function(t){(0,i.default)(o,t);var e=a(o);function o(t,n,i){var s;return(0,r.default)(this,o),(s=e.call(this)).socket=new window.WebSocket(t,i),s.socket.onopen=function(){return s.emit("open")},s.socket.onmessage=function(t){return s.emit("message",t.data)},s.socket.onerror=function(t){return s.emit("error",t)},s.socket.onclose=function(t){s.emit("close",t.code,t.reason)},s}return(0,n.default)(o,[{key:"send",value:function(t,e,r){var n=r||e;try{this.socket.send(t),n()}catch(t){n(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,r){this.socket.addEventListener(t,e,r)}}]),o}(dA().EventEmitter)}({});const{bytesToNumberBE:pA,hexToBytes:yA}=tE,gA={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=gA;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(128&n[0])throw new e("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:pA(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=gA,r="string"==typeof t?yA(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=gA._parseInt(r.subarray(2)),{d:s,l:a}=gA._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,r=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),u=r(s);return`30${r(s+o+4)}02${u}${i}02${a}${n}`}},mA=BigInt(0),wA=BigInt(1);BigInt(2);const bA=BigInt(3);function vA(t){const e=function(t){const e=vE(t);return Q_(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(t){return uE(t,n)}function a(t){return lE(t,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:h,isWithinCurveOrder:l}=function(t){const e=/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
42
42
  function(t){const e=vE(t);Q_(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:r}=e,n=e.toBytes||((t,e,n)=>{const i=e.toAffine();return $_(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:r.fromBytes(e.subarray(0,r.BYTES)),y:r.fromBytes(e.subarray(r.BYTES,2*r.BYTES))}});function o(t){const{a:n,b:i}=e,o=r.sqr(t),s=r.mul(o,t);return r.add(r.add(s,r.mul(t,n)),i)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&mA<t&&t<e.n}function a(t){if(!s(t))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(t){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:i,n:o}=e;if(r&&"bigint"!=typeof t){if(t instanceof Uint8Array&&(t=z_(t)),"string"!=typeof t||!r.includes(t.length))throw new Error("Invalid key");t=t.padStart(2*n,"0")}let s;try{s="bigint"==typeof t?t:F_(H_("private key",t,n))}catch(e){throw new Error(`private key must be ${n} bytes, hex or bigint, not ${typeof t}`)}return i&&(s=uE(s,o)),a(s),s}const c=new Map;function h(t){if(!(t instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(t,e,n){if(this.px=t,this.py=e,this.pz=n,null==t||!r.isValid(t))throw new Error("x required");if(null==e||!r.isValid(e))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required")}static fromAffine(t){const{x:e,y:n}=t||{};if(!t||!r.isValid(e)||!r.isValid(n))throw new Error("invalid affine point");if(t instanceof l)throw new Error("projective point not allowed");const i=t=>r.eql(t,r.ZERO);return i(e)&&i(n)?l.ZERO:new l(e,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=r.invertBatch(t.map((t=>t.pz)));return t.map(((t,r)=>t.toAffine(e[r]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(H_("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(u(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:n}=this.toAffine();if(!r.isValid(t)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),s=o(t);if(!r.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(r.isOdd)return!r.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){h(t);const{px:e,py:n,pz:i}=this,{px:o,py:s,pz:a}=t,u=r.eql(r.mul(e,a),r.mul(o,i)),c=r.eql(r.mul(n,a),r.mul(s,i));return u&&c}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){const{a:t,b:n}=e,i=r.mul(n,bA),{px:o,py:s,pz:a}=this;let u=r.ZERO,c=r.ZERO,h=r.ZERO,f=r.mul(o,o),d=r.mul(s,s),p=r.mul(a,a),y=r.mul(o,s);return y=r.add(y,y),h=r.mul(o,a),h=r.add(h,h),u=r.mul(t,h),c=r.mul(i,p),c=r.add(u,c),u=r.sub(d,c),c=r.add(d,c),c=r.mul(u,c),u=r.mul(y,u),h=r.mul(i,h),p=r.mul(t,p),y=r.sub(f,p),y=r.mul(t,y),y=r.add(y,h),h=r.add(f,f),f=r.add(h,f),f=r.add(f,p),f=r.mul(f,y),c=r.add(c,f),p=r.mul(s,a),p=r.add(p,p),f=r.mul(p,y),u=r.sub(u,f),h=r.mul(p,d),h=r.add(h,h),h=r.add(h,h),new l(u,c,h)}add(t){h(t);const{px:n,py:i,pz:o}=this,{px:s,py:a,pz:u}=t;let c=r.ZERO,f=r.ZERO,d=r.ZERO;const p=e.a,y=r.mul(e.b,bA);let g=r.mul(n,s),m=r.mul(i,a),w=r.mul(o,u),b=r.add(n,i),v=r.add(s,a);b=r.mul(b,v),v=r.add(g,m),b=r.sub(b,v),v=r.add(n,o);let _=r.add(s,u);return v=r.mul(v,_),_=r.add(g,w),v=r.sub(v,_),_=r.add(i,o),c=r.add(a,u),_=r.mul(_,c),c=r.add(m,w),_=r.sub(_,c),d=r.mul(p,v),c=r.mul(y,w),d=r.add(c,d),c=r.sub(m,d),d=r.add(m,d),f=r.mul(c,d),m=r.add(g,g),m=r.add(m,g),w=r.mul(p,w),v=r.mul(y,v),m=r.add(m,w),w=r.sub(g,w),w=r.mul(p,w),v=r.add(v,w),g=r.mul(m,v),f=r.add(f,g),g=r.mul(_,v),c=r.mul(b,c),c=r.sub(c,g),g=r.mul(b,m),d=r.mul(_,d),d=r.add(d,g),new l(c,f,d)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return d.wNAFCached(this,c,t,(t=>{const e=r.invertBatch(t.map((t=>t.pz)));return t.map(((t,r)=>t.toAffine(e[r]))).map(l.fromAffine)}))}multiplyUnsafe(t){const n=l.ZERO;if(t===mA)return n;if(a(t),t===wA)return this;const{endo:i}=e;if(!i)return d.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:u,k2:c}=i.splitScalar(t),h=n,f=n,p=this;for(;s>mA||c>mA;)s&wA&&(h=h.add(p)),c&wA&&(f=f.add(p)),p=p.double(),s>>=wA,c>>=wA;return o&&(h=h.negate()),u&&(f=f.negate()),f=new l(r.mul(f.px,i.beta),f.py,f.pz),h.add(f)}multiply(t){a(t);let n,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:u}=s.splitScalar(o);let{p:c,f:h}=this.wNAF(e),{p:f,f:p}=this.wNAF(u);c=d.constTimeNegate(t,c),f=d.constTimeNegate(a,f),f=new l(r.mul(f.px,s.beta),f.py,f.pz),n=c.add(f),i=h.add(p)}else{const{p:t,f:e}=this.wNAF(o);n=t,i=e}return l.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(t,e,r){const n=l.BASE,i=(t,e)=>e!==mA&&e!==wA&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,r));return o.is0()?void 0:o}toAffine(t){const{px:e,py:n,pz:i}=this,o=this.is0();null==t&&(t=o?r.ONE:r.inv(i));const s=r.mul(e,t),a=r.mul(n,t),u=r.mul(i,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(u,r.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:r}=e;if(t===wA)return!0;if(r)return r(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:r}=e;return t===wA?this:r?r(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),n(l,this,t)}toHex(t=!0){return z_(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);const f=e.nBitLength,d=bE(l,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,n){const i=e.toAffine(),o=r.toBytes(i.x),s=$_;return n?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(t){const e=t.length,n=t[0],s=t.subarray(1);if(e!==i||2!==n&&3!==n){if(e===o&&4===n)return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))};throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=F_(s);if(!(mA<(a=t)&&a<r.ORDER))throw new Error("Point is not on curve");const e=h(t);let i=r.sqrt(e);return 1==(1&n)!=((i&wA)===wA)&&(i=r.neg(i)),{x:t,y:i}}var a}}),f=t=>z_(V_(t,e.nByteLength));function d(t){return t>n>>wA}const p=(t,e,r)=>F_(t.slice(e,r));class y{constructor(t,e,r){this.r=t,this.s=e,this.recovery=r,this.assertValidity()}static fromCompact(t){const r=e.nByteLength;return t=H_("compactSignature",t,2*r),new y(p(t,0,r),p(t,r,2*r))}static fromDER(t){const{r:e,s:r}=gA.toSig(H_("DER",t));return new y(e,r)}assertValidity(){if(!l(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!l(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new y(this.r,this.s,t)}recoverPublicKey(t){const{r:n,s:i,recovery:o}=this,c=b(H_("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const h=2===o||3===o?n+e.n:n;if(h>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",d=u.fromHex(l+f(h)),p=a(h),y=s(-c*p),g=s(i*p),m=u.BASE.multiplyAndAddUnsafe(d,y,g);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return W_(this.toDERHex())}toDERHex(){return gA.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return W_(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const g={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=gE(e.n);return function(t,e,r=!1){const n=t.length,i=yE(e),o=gE(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const s=uE(r?F_(t):K_(t),e-rE)+rE;return r?q_(s,i):V_(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function m(t){const e=t instanceof Uint8Array,r="string"==typeof t,n=(e||r)&&t.length;return e?n===i||n===o:r?n===2*i||n===2*o:t instanceof u}const w=e.bits2int||function(t){const r=F_(t),n=8*t.length-e.nBitLength;return n>0?r>>BigInt(n):r},b=e.bits2int_modN||function(t){return s(w(t))},v=G_(e.nBitLength);function _(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(mA<=t&&t<v))throw new Error(`bigint expected < 2^${e.nBitLength}`);return V_(t,e.nByteLength)}function E(t,n,i=k){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:h}=e;let{lowS:f,prehash:p,extraEntropy:g}=i;null==f&&(f=!0),t=H_("msgHash",t),p&&(t=H_("prehashed msgHash",o(t)));const m=b(t),v=c(n),E=[_(v),_(m)];if(null!=g){const t=!0===g?h(r.BYTES):g;E.push(H_("extraEntropy",t))}const S=$_(...E),x=m;return{seed:S,k2sig:function(t){const e=w(t);if(!l(e))return;const r=a(e),n=u.BASE.multiply(e).toAffine(),i=s(n.x);if(i===mA)return;const o=s(r*s(x+i*v));if(o===mA)return;let c=(n.x===i?0:2)|Number(n.y&wA),h=o;return f&&d(o)&&(h=function(t){return d(t)?s(-t):t}(o),c^=1),new y(i,h,c)}}}const k={lowS:e.lowS,prehash:!1},S={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,r=!0){if(m(t))throw new Error("first arg must be private key");if(!m(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(c(t)).toRawBytes(r)},sign:function(t,r,n=k){const{seed:i,k2sig:o}=E(t,r,n),s=e;return J_(s.hash.outputLen,s.nByteLength,s.hmac)(i,o)},verify:function(t,r,n,i=S){const o=t;if(r=H_("msgHash",r),n=H_("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:h}=i;let l,f;try{if("string"==typeof o||o instanceof Uint8Array)try{l=y.fromDER(o)}catch(t){if(!(t instanceof gA.Err))throw t;l=y.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;l=new y(t,e)}}f=u.fromHex(n)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&l.hasHighS())return!1;h&&(r=e.hash(r));const{r:d,s:p}=l,g=b(r),m=a(p),w=s(g*m),v=s(d*m),_=u.BASE.multiplyAndAddUnsafe(f,w,v)?.toAffine();return!!_&&s(_.x)===d},ProjectivePoint:u,Signature:y,utils:g}}BigInt(4);class _A extends w_{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");h_(t.outputLen),h_(t.blockLen)}(t);const r=m_(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return f_(this),this.iHash.update(t),this}digestInto(t){f_(this),l_(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const EA=(t,e,r)=>new _A(t,e).update(r).digest()
43
43
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;function kA(t){return{hash:t,hmac:(e,...r)=>EA(t,e,function(...t){const e=new Uint8Array(t.reduce(((t,e)=>t+e.length),0));let r=0;return t.forEach((t=>{if(!p_(t))throw new Error("Uint8Array expected");e.set(t,r),r+=t.length})),e}(...r)),randomBytes:v_}}EA.create=(t,e)=>new _A(t,e)
44
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const SA=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),xA=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),AA=BigInt(1),IA=BigInt(2),BA=(t,e)=>(t+e/IA)/e,MA=pE(SA,void 0,void 0,{sqrt:function(t){const e=SA,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,h=c*c*t%e,l=hE(h,r,e)*h%e,f=hE(l,r,e)*h%e,d=hE(f,IA,e)*c%e,p=hE(d,i,e)*d%e,y=hE(p,o,e)*p%e,g=hE(y,a,e)*y%e,m=hE(g,u,e)*g%e,w=hE(m,a,e)*y%e,b=hE(w,r,e)*h%e,v=hE(b,s,e)*p%e,_=hE(v,n,e)*c%e,E=hE(_,IA,e);if(!MA.eql(MA.sqr(E),t))throw new Error("Cannot find square root");return E}}),RA=function(t,e){const r=e=>vA({...t,...kA(e)});return Object.freeze({...r(e),create:r})}({a:BigInt(0),b:BigInt(7),Fp:MA,n:xA,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=xA,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-AA*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=BA(o*t,e),u=BA(-n*t,e);let c=uE(t-a*r-u*i,e),h=uE(-a*n-u*o,e);const l=c>s,f=h>s;if(l&&(c=e-c),f&&(h=e-h),c>s||h>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:f,k2:h}}}},XE);function PA(t){try{return NE.ExtendedPoint.fromHex(t),!0}catch{return!1}}BigInt(0),RA.ProjectivePoint;const TA=NE.verify,OA=t=>t_.Buffer.isBuffer(t)?t:t instanceof Uint8Array?t_.Buffer.from(t.buffer,t.byteOffset,t.byteLength):t_.Buffer.from(t);class LA{constructor(t){Object.assign(this,t)}encode(){return t_.Buffer.from(Mk(UA,this))}static decode(t){return Tk(UA,this,t)}static decodeUnchecked(t){return gk(UA,this,t)}}const UA=new Map;var CA;let NA;const zA=32;let DA=1;NA=Symbol.toStringTag;class jA extends LA{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=HE.decode(t);if(e.length!=zA)throw new Error("Invalid public key input");this._bn=new FE(e)}else this._bn=new FE(t);if(this._bn.byteLength()>zA)throw new Error("Invalid public key input")}}static unique(){const t=new jA(DA);return DA+=1,new jA(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return HE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(t_.Buffer);if(t.length===zA)return t;const e=t_.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[NA](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){const n=t_.Buffer.concat([t.toBuffer(),t_.Buffer.from(e),r.toBuffer()]),i=XE(n);return new jA(i)}static createProgramAddressSync(t,e){let r=t_.Buffer.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");r=t_.Buffer.concat([r,OA(t)])})),r=t_.Buffer.concat([r,e.toBuffer(),t_.Buffer.from("ProgramDerivedAddress")]);const n=XE(r);if(PA(n))throw new Error("Invalid seeds, address must fall off the curve");return new jA(n)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r,n=255;for(;0!=n;){try{const i=t.concat(t_.Buffer.from([n]));r=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;n--;continue}return[r,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return PA(new jA(t).toBytes())}}CA=jA,jA.default=new CA("11111111111111111111111111111111"),UA.set(jA,{kind:"struct",fields:[["_bn","u256"]]}),new jA("BPFLoader1111111111111111111111111111111111");class WA{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t<e.length)return e[t];t-=e.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,r)=>{e.set(t.toBase58(),r)}));const r=t=>{const r=e.get(t.toBase58());if(void 0===r)throw new Error("Encountered an unknown instruction account key during compilation");return r};return t.map((t=>({programIdIndex:r(t.programId),accountKeyIndexes:t.keys.map((t=>r(t.pubkey))),data:t.data})))}}const FA=(t="publicKey")=>xS(32,t),KA=(t="string")=>{const e=kS([vS("length"),vS("lengthPadding"),xS(mS(vS(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(t,e)=>r(t,e).chars.toString(),i.encode=(t,e,r)=>{const i={chars:t_.Buffer.from(t,"utf8")};return n(i,e,r)},i.alloc=t=>vS().span+vS().span+t_.Buffer.from(t,"utf8").length,i};function VA(t,e){const r=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const n=e[t.property];if(Array.isArray(n))return n.length*r(t.elementLayout)}else if("fields"in t)return VA({layout:t},e[t.property]);return 0};let n=0;return t.layout.fields.forEach((t=>{n+=r(t)})),n}function qA(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(127&n)<<7*r,r+=1,0==(128&n))break}return e}function HA(t,e){let r=e;for(;;){let e=127&r;if(r>>=7,0==r){t.push(e);break}e|=128,t.push(e)}}function $A(t,e){if(!t)throw new Error(e||"Assertion failed")}class GA{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const r=new Map,n=t=>{const e=t.toBase58();let n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},i=n(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){n(e.programId).isInvoked=!0;for(const t of e.keys){const e=n(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new GA(e,r)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];$A(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),r=t.filter((([,t])=>t.isSigner&&!t.isWritable)),n=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{$A(e.length>0,"Expected at least one writable signer key");const[t]=e[0];$A(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new jA(t))),...r.map((([t])=>new jA(t))),...n.map((([t])=>new jA(t))),...i.map((([t])=>new jA(t)))]]}extractTableLookup(t){const[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[n,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==n.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(t,e){const r=new Array,n=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new jA(i),o=t.findIndex((t=>t.equals(e)));o>=0&&($A(o<256,"Max lookup table index exceeded"),r.push(o),n.push(e),this.keyMetaMap.delete(i))}return[r,n]}}class ZA{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new jA(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:HE.decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new WA(this.staticAccountKeys)}static compile(t){const e=GA.compile(t.instructions,t.payerKey),[r,n]=e.getMessageComponents(),i=new WA(n).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:HE.encode(t.data)})));return new ZA({header:r,accountKeys:n,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const e=this.header.numRequiredSignatures;return t>=this.header.numRequiredSignatures?t-e<this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts:t<e-this.header.numReadonlySignedAccounts}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((t,e)=>!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];HA(e,t);const r=this.instructions.map((t=>{const{accounts:e,programIdIndex:r}=t,n=Array.from(HE.decode(t.data));let i=[];HA(i,e.length);let o=[];return HA(o,n.length),{programIdIndex:r,keyIndicesCount:t_.Buffer.from(i),keyIndices:e,dataLength:t_.Buffer.from(o),data:n}}));let n=[];HA(n,r.length);let i=t_.Buffer.alloc(1232);t_.Buffer.from(n).copy(i);let o=n.length;r.forEach((t=>{const e=kS([wS("programIdIndex"),xS(t.keyIndicesCount.length,"keyIndicesCount"),SS(wS("keyIndex"),t.keyIndices.length,"keyIndices"),xS(t.dataLength.length,"dataLength"),SS(wS("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const s=kS([xS(1,"numRequiredSignatures"),xS(1,"numReadonlySignedAccounts"),xS(1,"numReadonlyUnsignedAccounts"),xS(e.length,"keyCount"),SS(FA("key"),t,"keys"),FA("recentBlockhash")]),a={numRequiredSignatures:t_.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:t_.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:t_.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:t_.Buffer.from(e),keys:this.accountKeys.map((t=>OA(t.toBytes()))),recentBlockhash:HE.decode(this.recentBlockhash)};let u=t_.Buffer.alloc(2048);const c=s.encode(a,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(t){let e=[...t];const r=e.shift();if(r!==(127&r))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const n=e.shift(),i=e.shift(),o=qA(e);let s=[];for(let t=0;t<o;t++){const t=e.slice(0,zA);e=e.slice(zA),s.push(new jA(t_.Buffer.from(t)))}const a=e.slice(0,zA);e=e.slice(zA);const u=qA(e);let c=[];for(let t=0;t<u;t++){const t=e.shift(),r=qA(e),n=e.slice(0,r);e=e.slice(r);const i=qA(e),o=e.slice(0,i),s=HE.encode(t_.Buffer.from(o));e=e.slice(i),c.push({programIdIndex:t,accounts:n,data:s})}const h={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:i},recentBlockhash:HE.encode(t_.Buffer.from(a)),accountKeys:s,instructions:c};return new ZA(h)}}const YA=t_.Buffer.alloc(64).fill(0);class JA{constructor(t){this.keys=void 0,this.programId=void 0,this.data=t_.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:r})=>({pubkey:t.toJSON(),isSigner:e,isWritable:r}))),programId:this.programId.toJSON(),data:[...this.data]}}}class XA{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:r}=t;this.minNonceContextSlot=e,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:r}=t;this.recentBlockhash=e,this.lastValidBlockHeight=r}else{const{recentBlockhash:e,nonceInfo:r}=t;r&&(this.nonceInfo=r),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new JA(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,r;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)r=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");r=this.signatures[0].publicKey}for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw new Error(`Transaction instruction index ${t} has undefined program id`);const n=[],i=[];e.forEach((t=>{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();n.includes(e)||n.push(e)})),n.forEach((t=>{i.push({pubkey:new jA(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),r=o.findIndex((t=>t.pubkey.toString()===e));r>-1?(o[r].isWritable=o[r].isWritable||t.isWritable,o[r].isSigner=o[r].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(r)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const h=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:r})=>{e?(h.push(t.toString()),a+=1,r||(u+=1)):(l.push(t.toString()),r||(c+=1))}));const f=h.concat(l),d=e.map((t=>{const{data:e,programId:r}=t;return{programIdIndex:f.indexOf(r.toString()),accounts:t.keys.map((t=>f.indexOf(t.pubkey.toString()))),data:HE.encode(e)}}));return d.forEach((t=>{$A(t.programIdIndex>=0),t.accounts.forEach((t=>$A(t>=0)))})),new ZA({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:f,recentBlockhash:t,instructions:d})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,r)=>e[r].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const r=t.toString();return!e.has(r)&&(e.add(r),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,r=[];for(const n of t){const t=n.publicKey.toString();e.has(t)||(e.add(t),r.push(n))}this.signatures=r.map((t=>({signature:null,publicKey:t.publicKey})));const n=this._compile();this._partialSign(n,...r)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,r=[];for(const n of t){const t=n.publicKey.toString();e.has(t)||(e.add(t),r.push(n))}const n=this._compile();this._partialSign(n,...r)}_partialSign(t,...e){const r=t.serialize();e.forEach((t=>{const e=((t,e)=>NE.sign(t,e.slice(0,32)))(r,t.secretKey);this._addSignature(t.publicKey,OA(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){$A(64===e.length);const r=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(r<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=t_.Buffer.from(e)}verifySignatures(t){return this._verifySignatures(this.serializeMessage(),void 0===t||t)}_verifySignatures(t,e){for(const{signature:r,publicKey:n}of this.signatures)if(null===r){if(e)return!1}else if(!TA(r,t,n.toBytes()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),n=this.serializeMessage();if(r&&!this._verifySignatures(n,e))throw new Error("Signature verification failed");return this._serialize(n)}_serialize(t){const{signatures:e}=this,r=[];HA(r,e.length);const n=r.length+64*e.length+t.length,i=t_.Buffer.alloc(n);return $A(e.length<256),t_.Buffer.from(r).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&($A(64===t.length,"signature has invalid length"),t_.Buffer.from(t).copy(i,r.length+64*e))})),t.copy(i,r.length+64*e.length),$A(i.length<=1232,`Transaction too large: ${i.length} > 1232`),i}get keys(){return $A(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return $A(1===this.instructions.length),this.instructions[0].programId}get data(){return $A(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const r=qA(e);let n=[];for(let t=0;t<r;t++){const t=e.slice(0,64);e=e.slice(64),n.push(HE.encode(t_.Buffer.from(t)))}return XA.populate(ZA.from(e),n)}static populate(t,e=[]){const r=new XA;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach(((e,n)=>{const i={signature:e==HE.encode(YA)?null:HE.decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)})),t.instructions.forEach((e=>{const n=e.accounts.map((e=>{const n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some((t=>t.publicKey.toString()===n.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));r.instructions.push(new JA({keys:n,programId:t.accountKeys[e.programIdIndex],data:HE.decode(e.data)}))})),r._message=t,r._json=r.toJSON(),r}}new jA("SysvarC1ock11111111111111111111111111111111"),new jA("SysvarEpochSchedu1e111111111111111111111111"),new jA("Sysvar1nstructions1111111111111111111111111");const QA=new jA("SysvarRecentB1ockHashes11111111111111111111"),tI=new jA("SysvarRent111111111111111111111111111111111");function eI(t,e){const r=t.layout.span>=0?t.layout.span:VA(t,e),n=t_.Buffer.alloc(r),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,n),n}new jA("SysvarRewards111111111111111111111111111111"),new jA("SysvarS1otHashes111111111111111111111111111"),new jA("SysvarS1otHistory11111111111111111111111111"),new jA("SysvarStakeHistory1111111111111111111111111");const rI=_S("lamportsPerSignature"),nI=kS([vS("version"),vS("state"),FA("authorizedPubkey"),FA("nonce"),kS([rI],"feeCalculator")]).span,iI=(8,t=>{const e=xS(8,t),{encode:r,decode:n}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const r=n(t,e);return IS(t_.Buffer.from(r))},i.encode=(t,e,n)=>{const i=MS(t,8);return r(i,e,n)},i});const oI=Object.freeze({Create:{index:0,layout:kS([vS("instruction"),ES("lamports"),ES("space"),FA("programId")])},Assign:{index:1,layout:kS([vS("instruction"),FA("programId")])},Transfer:{index:2,layout:kS([vS("instruction"),iI("lamports")])},CreateWithSeed:{index:3,layout:kS([vS("instruction"),FA("base"),KA("seed"),ES("lamports"),ES("space"),FA("programId")])},AdvanceNonceAccount:{index:4,layout:kS([vS("instruction")])},WithdrawNonceAccount:{index:5,layout:kS([vS("instruction"),ES("lamports")])},InitializeNonceAccount:{index:6,layout:kS([vS("instruction"),FA("authorized")])},AuthorizeNonceAccount:{index:7,layout:kS([vS("instruction"),FA("authorized")])},Allocate:{index:8,layout:kS([vS("instruction"),ES("space")])},AllocateWithSeed:{index:9,layout:kS([vS("instruction"),FA("base"),KA("seed"),ES("space"),FA("programId")])},AssignWithSeed:{index:10,layout:kS([vS("instruction"),FA("base"),KA("seed"),FA("programId")])},TransferWithSeed:{index:11,layout:kS([vS("instruction"),iI("lamports"),KA("seed"),FA("programId")])},UpgradeNonceAccount:{index:12,layout:kS([vS("instruction")])}});class sI{constructor(){}static createAccount(t){const e=eI(oI.Create,{lamports:t.lamports,space:t.space,programId:OA(t.programId.toBuffer())});return new JA({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,r;return"basePubkey"in t?(e=eI(oI.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=eI(oI.Transfer,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new JA({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;return"basePubkey"in t?(e=eI(oI.AssignWithSeed,{base:OA(t.basePubkey.toBuffer()),seed:t.seed,programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=eI(oI.Assign,{programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new JA({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=eI(oI.CreateWithSeed,{base:OA(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:OA(t.programId.toBuffer())});let r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&r.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new JA({keys:r,programId:this.programId,data:e})}static createNonceAccount(t){const e=new XA;"basePubkey"in t&&"seed"in t?e.add(sI.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:nI,programId:this.programId})):e.add(sI.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:nI,programId:this.programId}));const r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){const e=eI(oI.InitializeNonceAccount,{authorized:OA(t.authorizedPubkey.toBuffer())}),r={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:QA,isSigner:!1,isWritable:!1},{pubkey:tI,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new JA(r)}static nonceAdvance(t){const e=eI(oI.AdvanceNonceAccount),r={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:QA,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new JA(r)}static nonceWithdraw(t){const e=eI(oI.WithdrawNonceAccount,{lamports:t.lamports});return new JA({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:QA,isSigner:!1,isWritable:!1},{pubkey:tI,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=eI(oI.AuthorizeNonceAccount,{authorized:OA(t.newAuthorizedPubkey.toBuffer())});return new JA({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,r;return"basePubkey"in t?(e=eI(oI.AllocateWithSeed,{base:OA(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=eI(oI.Allocate,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new JA({keys:r,programId:this.programId,data:e})}}sI.programId=new jA("11111111111111111111111111111111"),new jA("BPFLoader2111111111111111111111111111111111"),kS([vS("typeIndex"),iI("deactivationSlot"),_S("lastExtendedSlot"),wS("lastExtendedStartIndex"),wS(),SS(FA(),mS(wS(),-1),"authority")]);const aI=tx(KS(jA),ZS(),(t=>new jA(t))),uI=YS([ZS(),VS("base64")]),cI=tx(KS(t_.Buffer),uI,(t=>t_.Buffer.from(t[0],"base64")));function hI(t){return XS([JS({jsonrpc:VS("2.0"),id:ZS(),result:t}),JS({jsonrpc:VS("2.0"),id:ZS(),error:JS({code:QS(),message:ZS(),data:$S(jS("any",(()=>!0)))})})])}const lI=hI(QS());function fI(t){return tx(hI(t),lI,(e=>"error"in e?e:{...e,result:NS(e.result,t)}))}function dI(t){return fI(JS({context:JS({slot:HS()}),value:t}))}function pI(t){return JS({context:JS({slot:HS()}),value:t})}const yI=JS({foundation:HS(),foundationTerm:HS(),initial:HS(),taper:HS(),terminal:HS()});fI(WS(qS(JS({epoch:HS(),effectiveSlot:HS(),amount:HS(),postBalance:HS(),commission:$S(qS(HS()))}))));const gI=WS(JS({slot:HS(),prioritizationFee:HS()})),mI=JS({total:HS(),validator:HS(),foundation:HS(),epoch:HS()}),wI=JS({epoch:HS(),slotIndex:HS(),slotsInEpoch:HS(),absoluteSlot:HS(),blockHeight:$S(HS()),transactionCount:$S(HS())}),bI=JS({slotsPerEpoch:HS(),leaderScheduleSlotOffset:HS(),warmup:FS(),firstNormalEpoch:HS(),firstNormalSlot:HS()}),vI=GS(ZS(),WS(HS())),_I=qS(XS([JS({}),ZS()])),EI=JS({err:_I}),kI=VS("receivedSignature");JS({"solana-core":ZS(),"feature-set":$S(HS())}),dI(JS({err:qS(XS([JS({}),ZS()])),logs:qS(WS(ZS())),accounts:$S(qS(WS(qS(JS({executable:FS(),owner:ZS(),lamports:HS(),data:WS(ZS()),rentEpoch:$S(HS())}))))),unitsConsumed:$S(HS()),returnData:$S(qS(JS({programId:ZS(),data:YS([ZS(),VS("base64")])})))})),dI(JS({byIdentity:GS(ZS(),WS(HS())),range:JS({firstSlot:HS(),lastSlot:HS()})})),fI(yI),fI(mI),fI(gI),fI(wI),fI(bI),fI(vI),fI(HS()),dI(JS({total:HS(),circulating:HS(),nonCirculating:HS(),nonCirculatingAccounts:WS(aI)}));const SI=JS({amount:ZS(),uiAmount:qS(HS()),decimals:HS(),uiAmountString:$S(ZS())});dI(WS(JS({address:aI,amount:ZS(),uiAmount:qS(HS()),decimals:HS(),uiAmountString:$S(ZS())}))),dI(WS(JS({pubkey:aI,account:JS({executable:FS(),owner:aI,lamports:HS(),data:cI,rentEpoch:HS()})})));const xI=JS({program:ZS(),parsed:QS(),space:HS()});dI(WS(JS({pubkey:aI,account:JS({executable:FS(),owner:aI,lamports:HS(),data:xI,rentEpoch:HS()})}))),dI(WS(JS({lamports:HS(),address:aI})));const AI=JS({executable:FS(),owner:aI,lamports:HS(),data:cI,rentEpoch:HS()});JS({pubkey:aI,account:AI});const II=tx(XS([KS(t_.Buffer),xI]),XS([uI,xI]),(t=>Array.isArray(t)?NS(t,cI):t)),BI=JS({executable:FS(),owner:aI,lamports:HS(),data:II,rentEpoch:HS()});JS({pubkey:aI,account:BI}),JS({state:XS([VS("active"),VS("inactive"),VS("activating"),VS("deactivating")]),active:HS(),inactive:HS()}),fI(WS(JS({signature:ZS(),slot:HS(),err:_I,memo:qS(ZS()),blockTime:$S(qS(HS()))}))),fI(WS(JS({signature:ZS(),slot:HS(),err:_I,memo:qS(ZS()),blockTime:$S(qS(HS()))}))),JS({subscription:HS(),result:pI(AI)});const MI=JS({pubkey:aI,account:AI});JS({subscription:HS(),result:pI(MI)});const RI=JS({parent:HS(),slot:HS(),root:HS()});JS({subscription:HS(),result:RI});const PI=XS([JS({type:XS([VS("firstShredReceived"),VS("completed"),VS("optimisticConfirmation"),VS("root")]),slot:HS(),timestamp:HS()}),JS({type:VS("createdBank"),parent:HS(),slot:HS(),timestamp:HS()}),JS({type:VS("frozen"),slot:HS(),timestamp:HS(),stats:JS({numTransactionEntries:HS(),numSuccessfulTransactions:HS(),numFailedTransactions:HS(),maxTransactionsPerEntry:HS()})}),JS({type:VS("dead"),slot:HS(),timestamp:HS(),err:ZS()})]);JS({subscription:HS(),result:PI}),JS({subscription:HS(),result:pI(XS([EI,kI]))}),JS({subscription:HS(),result:HS()}),JS({pubkey:ZS(),gossip:qS(ZS()),tpu:qS(ZS()),rpc:qS(ZS()),version:qS(ZS())});const TI=JS({votePubkey:ZS(),nodePubkey:ZS(),activatedStake:HS(),epochVoteAccount:FS(),epochCredits:WS(YS([HS(),HS(),HS()])),commission:HS(),lastVote:HS(),rootSlot:qS(HS())});fI(JS({current:WS(TI),delinquent:WS(TI)}));const OI=XS([VS("processed"),VS("confirmed"),VS("finalized")]),LI=JS({slot:HS(),confirmations:qS(HS()),err:_I,confirmationStatus:$S(OI)});dI(WS(qS(LI))),fI(HS());const UI=JS({accountKey:aI,writableIndexes:WS(HS()),readonlyIndexes:WS(HS())}),CI=JS({signatures:WS(ZS()),message:JS({accountKeys:WS(ZS()),header:JS({numRequiredSignatures:HS(),numReadonlySignedAccounts:HS(),numReadonlyUnsignedAccounts:HS()}),instructions:WS(JS({accounts:WS(HS()),data:ZS(),programIdIndex:HS()})),recentBlockhash:ZS(),addressTableLookups:$S(WS(UI))})}),NI=JS({pubkey:aI,signer:FS(),writable:FS(),source:$S(XS([VS("transaction"),VS("lookupTable")]))}),zI=JS({accountKeys:WS(NI),signatures:WS(ZS())}),DI=JS({parsed:QS(),program:ZS(),programId:aI}),jI=JS({accounts:WS(aI),data:ZS(),programId:aI}),WI=tx(XS([jI,DI]),XS([JS({parsed:QS(),program:ZS(),programId:ZS()}),JS({accounts:WS(ZS()),data:ZS(),programId:ZS()})]),(t=>NS(t,"accounts"in t?jI:DI))),FI=JS({signatures:WS(ZS()),message:JS({accountKeys:WS(NI),instructions:WS(WI),recentBlockhash:ZS(),addressTableLookups:$S(qS(WS(UI)))})}),KI=JS({accountIndex:HS(),mint:ZS(),owner:$S(ZS()),uiTokenAmount:SI}),VI=JS({writable:WS(aI),readonly:WS(aI)}),qI=JS({err:_I,fee:HS(),innerInstructions:$S(qS(WS(JS({index:HS(),instructions:WS(JS({accounts:WS(HS()),data:ZS(),programIdIndex:HS()}))})))),preBalances:WS(HS()),postBalances:WS(HS()),logMessages:$S(qS(WS(ZS()))),preTokenBalances:$S(qS(WS(KI))),postTokenBalances:$S(qS(WS(KI))),loadedAddresses:$S(VI),computeUnitsConsumed:$S(HS())}),HI=JS({err:_I,fee:HS(),innerInstructions:$S(qS(WS(JS({index:HS(),instructions:WS(WI)})))),preBalances:WS(HS()),postBalances:WS(HS()),logMessages:$S(qS(WS(ZS()))),preTokenBalances:$S(qS(WS(KI))),postTokenBalances:$S(qS(WS(KI))),loadedAddresses:$S(VI),computeUnitsConsumed:$S(HS())}),$I=XS([VS(0),VS("legacy")]),GI=JS({pubkey:ZS(),lamports:HS(),postBalance:qS(HS()),rewardType:qS(ZS()),commission:$S(qS(HS()))});fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:CI,meta:qS(qI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:zI,meta:qS(qI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:FI,meta:qS(HI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:zI,meta:qS(HI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:CI,meta:qS(qI)})),rewards:$S(WS(GI)),blockTime:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),signatures:WS(ZS()),blockTime:qS(HS())}))),fI(qS(JS({slot:HS(),meta:qI,blockTime:$S(qS(HS())),transaction:CI,version:$S($I)}))),fI(qS(JS({slot:HS(),transaction:FI,meta:qS(HI),blockTime:$S(qS(HS())),version:$S($I)}))),dI(JS({blockhash:ZS(),feeCalculator:JS({lamportsPerSignature:HS()})})),dI(JS({blockhash:ZS(),lastValidBlockHeight:HS()})),dI(FS()),fI(WS(JS({slot:HS(),numTransactions:HS(),numSlots:HS(),samplePeriodSecs:HS()}))),dI(qS(JS({feeCalculator:JS({lamportsPerSignature:HS()})}))),fI(ZS()),fI(ZS());const ZI=JS({err:_I,logs:WS(ZS()),signature:ZS()});var YI;JS({result:pI(ZI),subscription:HS()}),Object.freeze({CreateLookupTable:{index:0,layout:kS([vS("instruction"),iI("recentSlot"),wS("bumpSeed")])},FreezeLookupTable:{index:1,layout:kS([vS("instruction")])},ExtendLookupTable:{index:2,layout:kS([vS("instruction"),iI(),SS(FA(),mS(vS(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:kS([vS("instruction")])},CloseLookupTable:{index:4,layout:kS([vS("instruction")])}}),new jA("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:kS([wS("instruction"),vS("units"),vS("additionalFee")])},RequestHeapFrame:{index:1,layout:kS([wS("instruction"),vS("bytes")])},SetComputeUnitLimit:{index:2,layout:kS([wS("instruction"),vS("units")])},SetComputeUnitPrice:{index:3,layout:kS([wS("instruction"),iI("microLamports")])}}),new jA("ComputeBudget111111111111111111111111111111"),kS([wS("numSignatures"),wS("padding"),bS("signatureOffset"),bS("signatureInstructionIndex"),bS("publicKeyOffset"),bS("publicKeyInstructionIndex"),bS("messageDataOffset"),bS("messageDataSize"),bS("messageInstructionIndex")]),new jA("Ed25519SigVerify111111111111111111111111111"),RA.utils.isValidPrivateKey,RA.getPublicKey,kS([wS("numSignatures"),bS("signatureOffset"),wS("signatureInstructionIndex"),bS("ethAddressOffset"),wS("ethAddressInstructionIndex"),bS("messageDataOffset"),bS("messageDataSize"),wS("messageInstructionIndex"),xS(20,"ethAddress"),xS(64,"signature"),wS("recoveryId")]),new jA("KeccakSecp256k11111111111111111111111111111"),new jA("StakeConfig11111111111111111111111111111111");class JI{constructor(t,e,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=r}}YI=JI,JI.default=new YI(0,0,jA.default),Object.freeze({Initialize:{index:0,layout:kS([vS("instruction"),((t="authorized")=>kS([FA("staker"),FA("withdrawer")],t))(),((t="lockup")=>kS([ES("unixTimestamp"),ES("epoch"),FA("custodian")],t))()])},Authorize:{index:1,layout:kS([vS("instruction"),FA("newAuthorized"),vS("stakeAuthorizationType")])},Delegate:{index:2,layout:kS([vS("instruction")])},Split:{index:3,layout:kS([vS("instruction"),ES("lamports")])},Withdraw:{index:4,layout:kS([vS("instruction"),ES("lamports")])},Deactivate:{index:5,layout:kS([vS("instruction")])},Merge:{index:7,layout:kS([vS("instruction")])},AuthorizeWithSeed:{index:8,layout:kS([vS("instruction"),FA("newAuthorized"),vS("stakeAuthorizationType"),KA("authoritySeed"),FA("authorityOwner")])}}),Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),new jA("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:kS([vS("instruction"),((t="voteInit")=>kS([FA("nodePubkey"),FA("authorizedVoter"),FA("authorizedWithdrawer"),wS("commission")],t))()])},Authorize:{index:1,layout:kS([vS("instruction"),FA("newAuthorized"),vS("voteAuthorizationType")])},Withdraw:{index:3,layout:kS([vS("instruction"),ES("lamports")])},AuthorizeWithSeed:{index:10,layout:kS([vS("instruction"),((t="voteAuthorizeWithSeedArgs")=>kS([vS("voteAuthorizationType"),FA("currentAuthorityDerivedKeyOwnerPubkey"),KA("currentAuthorityDerivedKeySeed"),FA("newAuthorized")],t))()])}}),Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),new jA("Vote111111111111111111111111111111111111111"),new jA("Va1idator1nfo111111111111111111111111111111"),JS({name:ZS(),website:$S(ZS()),details:$S(ZS()),keybaseUsername:$S(ZS())}),new jA("Vote111111111111111111111111111111111111111"),kS([FA("nodePubkey"),FA("authorizedWithdrawer"),wS("commission"),_S(),SS(kS([_S("slot"),vS("confirmationCount")]),mS(vS(),-8),"votes"),wS("rootSlotValid"),_S("rootSlot"),_S(),SS(kS([_S("epoch"),FA("authorizedVoter")]),mS(vS(),-8),"authorizedVoters"),kS([SS(kS([FA("authorizedPubkey"),_S("epochOfLastAuthorizedSwitch"),_S("targetEpoch")]),32,"buf"),_S("idx"),wS("isEmpty")],"priorVoters"),_S(),SS(kS([_S("epoch"),_S("credits"),_S("prevCredits")]),mS(vS(),-8),"epochCredits"),kS([_S("slot"),_S("timestamp")],"lastTimestamp")]);var XI,QI=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],tB=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}(),eB=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}(),rB=(XI=function(t,e){return XI=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])},XI(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}XI(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function nB(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function iB(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 oB=QI.concat(["bool","string"]),sB=["option","enum","array","set","map","struct"],aB=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return rB(e,t),e}(Error);function uB(t){if("string"!=typeof t||!oB.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&sB.includes(e[0])){var r=e[0];if("option"===r)return uB(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new aB(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');uB({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new aB(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return uB(t.type);throw new aB(t,"{ type, len? }")}(t[r]);if("set"===r)return uB(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new aB(t,"{ key, value }");uB(t.key),uB(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new aB(t,"object");for(var e in t)uB(t[e])}(t[r])}}throw new aB(t,sB.join(", ")+" or "+oB.join(", "))}}var cB=function(){function t(t){this.encoded=new tB,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(QI.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&&nB(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&&nB(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&&nB(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?iB(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?iB(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&&nB(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&&nB(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&&nB(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}(),hB=function(){function t(t){this.buffer=new eB(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(QI.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 lB(t,e,r){return void 0===r&&(r=!0),r&&uB(t),new cB(r).encode(e,t)}class fB{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return lB(fB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}fB.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class dB{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return lB(dB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}dB.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class pB{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return lB(pB.schema,this)}getInstruction(t,e,r,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let h=[];return h.push({pubkey:e,isSigner:!1,isWritable:!1}),h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!0,isWritable:!0}),h.push({pubkey:i,isSigner:!1,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:!1}),h.push({pubkey:u,isSigner:!0,isWritable:!0}),new JA({keys:h,programId:t,data:c})}}pB.schema={struct:{tag:"u8",staleness:"bool"}};class yB{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return lB(yB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}yB.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class gB{constructor(){this.tag=5}serialize(){return lB(gB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}gB.schema={struct:{tag:"u8"}};class mB{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return lB(mB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}mB.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const wB=new jA("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[bB]=jA.findProgramAddressSync([wB.toBuffer()],wB);var vB;!function(t){t[t.None=0]="None",t[t.Solana=1]="Solana",t[t.Ethereum=2]="Ethereum",t[t.UnverifiedSolana=3]="UnverifiedSolana"}(vB||(vB={}));const _B=t=>{switch(t){case vB.None:return 0;case vB.Ethereum:return 20;case vB.Solana:case vB.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class EB{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new EB(function(t,e,r){return void 0===r&&(r=!0),r&&uB(t),new hB(e).decode(t)}(this.schema,t,!0))}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))}}EB.LEN=8,EB.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class kB{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=EB.deserialize(t.slice(96,96+EB.LEN)),r=t.slice(96+EB.LEN);return new kB(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=_B(this.header.stalenessValidation)+_B(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=_B(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=_B(this.header.stalenessValidation),e=t+_B(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var SB;exports.Record=void 0,(SB=exports.Record||(exports.Record={})).IPFS="IPFS",SB.ARWV="ARWV",SB.SOL="SOL",SB.ETH="ETH",SB.BTC="BTC",SB.LTC="LTC",SB.DOGE="DOGE",SB.Email="email",SB.Url="url",SB.Discord="discord",SB.Github="github",SB.Reddit="reddit",SB.Twitter="twitter",SB.Telegram="telegram",SB.Pic="pic",SB.SHDW="SHDW",SB.POINT="POINT",SB.BSC="BSC",SB.Injective="INJ",SB.Backpack="backpack",SB.A="A",SB.AAAA="AAAA",SB.CNAME="CNAME",SB.TXT="TXT",SB.Background="background";const xB=new Map([[exports.Record.SOL,96],[exports.Record.ETH,20],[exports.Record.BSC,20],[exports.Record.Injective,20],[exports.Record.A,4],[exports.Record.AAAA,16],[exports.Record.Background,32]]);var AB;exports.RecordVersion=void 0,(AB=exports.RecordVersion||(exports.RecordVersion={}))[AB.V1=1]="V1",AB[AB.V2=2]="V2";var IB="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=",BB="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",MB=0,RB=-3;function PB(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function TB(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new PB,this.dtree=new PB}var OB=new PB,LB=new PB,UB=new Uint8Array(30),CB=new Uint16Array(30),NB=new Uint8Array(30),zB=new Uint16Array(30),DB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jB=new PB,WB=new Uint8Array(320);function FB(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 KB=new Uint16Array(16);function VB(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)KB[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[KB[e[r+i]]++]=i)}function qB(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function HB(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 $B(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 GB(t,e,r){var n,i,o,s,a,u;for(n=HB(t,5,257),i=HB(t,5,1),o=HB(t,4,4),s=0;s<19;++s)WB[s]=0;for(s=0;s<o;++s){var c=HB(t,3,0);WB[DB[s]]=c}for(VB(jB,WB,0,19),a=0;a<n+i;){var h=$B(t,jB);switch(h){case 16:var l=WB[a-1];for(u=HB(t,2,3);u;--u)WB[a++]=l;break;case 17:for(u=HB(t,3,3);u;--u)WB[a++]=0;break;case 18:for(u=HB(t,7,11);u;--u)WB[a++]=0;break;default:WB[a++]=h}}VB(e,WB,0,n),VB(r,WB,n,i)}function ZB(t,e,r){for(;;){var n,i,o,s,a=$B(t,e);if(256===a)return MB;if(a<256)t.dest[t.destLen++]=a;else for(n=HB(t,UB[a-=257],CB[a]),i=$B(t,r),s=o=t.destLen-HB(t,NB[i],zB[i]);s<o+n;++s)t.dest[t.destLen++]=t.dest[s]}}function YB(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 RB;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,MB}!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}(OB,LB),FB(UB,CB,4,3),FB(NB,zB,2,1),UB[28]=0,CB[28]=258;var JB=function(t,e){var r,n,i=new TB(t,e);do{switch(r=qB(i),HB(i,2,0)){case 0:n=YB(i);break;case 1:n=ZB(i,OB,LB);break;case 2:GB(i,i.ltree,i.dtree),n=ZB(i,i.ltree,i.dtree);break;default:n=RB}if(n!==MB)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 XB=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],QB=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var tM={swap32LE:t=>{XB&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)QB(t,r,r+3),QB(t,r+1,r+2)})(t)}};const eM=JB,{swap32LE:rM}=tM;var nM=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=eM(t,new Uint8Array(r)),t=eM(t,new Uint8Array(r)),rM(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]}},iM={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,iM.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),h=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,l=String.fromCharCode.bind(String),f="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},d=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,m=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(l.apply(null,t.subarray(n,n+e)));return g(r.join(""))},w=function(t,e){return void 0===e&&(e=!1),e?d(m(t)):m(t)},b=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?l(192|e>>>6)+l(128|63&e):l(224|e>>>12&15)+l(128|e>>>6&63)+l(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return l(240|e>>>18&7)+l(128|e>>>12&63)+l(128|e>>>6&63)+l(128|63&e)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function(t){return t.replace(v,b)},E=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return m(s.encode(t))}:function(t){return g(_(t))},k=function(t,e){return void 0===e&&(e=!1),e?d(E(t)):E(t)},S=function(t){return k(t,!0)},x=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,A=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 l(55296+(e>>>10))+l(56320+(1023&e));case 3:return l((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return l((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},I=function(t){return t.replace(x,A)},B=function(t){if(t=t.replace(/\s+/g,""),!h.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?l(e>>16&255):64===n?l(e>>16&255,e>>8&255):l(e>>16&255,e>>8&255,255&e);return i},M=r?function(t){return atob(p(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:B,R=i?function(t){return f(Buffer.from(t,"base64"))}:function(t){return f(M(t).split("").map((function(t){return t.charCodeAt(0)})))},P=function(t){return R(O(t))},T=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:o?function(t){return o.decode(R(t))}:function(t){return I(M(t))},O=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},L=function(t){return T(O(t))},U=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)},C=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},N=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,C(e))};t("fromBase64",(function(){return L(this)})),t("toBase64",(function(t){return k(this,t)})),t("toBase64URI",(function(){return k(this,!0)})),t("toBase64URL",(function(){return k(this,!0)})),t("toUint8Array",(function(){return P(this)}))},z=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,C(e))};t("toBase64",(function(t){return w(this,t)})),t("toBase64URI",(function(){return w(this,!0)})),t("toBase64URL",(function(){return w(this,!0)}))},D=function(){N(),z()},j={version:t,VERSION:e,atob:M,atobPolyfill:B,btoa:g,btoaPolyfill:y,fromBase64:L,toBase64:k,encode:k,encodeURI:S,encodeURL:S,utob:_,btou:I,decode:L,isValid:U,fromUint8Array:w,toUint8Array:P,extendString:N,extendUint8Array:z,extendBuiltins:D,Base64:{}};return Object.keys(j).forEach((function(t){return j.Base64[t]=j[t]})),j}();const oM={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},sM=IB,aM=BB,uM=nM,cM=iM.exports.Base64,hM=new uM(cM.toUint8Array(sM)),lM=new uM(cM.toUint8Array(aM));function fM(t,e){return 0!=(t&e)}const dM=0,pM=1,yM=2;function gM(t,e){const r=t.length;let n=0,i=dM;for(let o=e;o+1<r;o++){const r=t[o+0],s=t[o+1];switch(fM(r,oM.Regional_Indicator)||(n=0),i){case yM:case dM:i=fM(r,oM.Extended_Pictographic)?pM:dM;break;case pM:i=fM(r,oM.Extend)?pM:fM(r,oM.ZWJ)&&fM(s,oM.Extended_Pictographic)?yM:dM}if(!fM(r,oM.CR)||!fM(s,oM.LF)){if(fM(r,oM.Control|oM.CR|oM.LF))return o+1-e;if(fM(s,oM.Control|oM.CR|oM.LF))return o+1-e;if(!(fM(r,oM.L)&&fM(s,oM.L|oM.V|oM.LV|oM.LVT)||fM(r,oM.LV|oM.V)&&fM(s,oM.V|oM.T)||fM(r,oM.LVT|oM.T)&&fM(s,oM.T)||fM(s,oM.Extend|oM.ZWJ)||fM(s,oM.SpacingMark)||fM(r,oM.Prepend)||i===yM)){if(!fM(r,oM.Regional_Indicator)||!fM(s,oM.Regional_Indicator)||n%2!=0)return o+1-e;n++}}}return r-e}var mM=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const i=t.codePointAt(e);n.push(hM.get(i)|lM.get(i)),e+=i>65535?2:1,r.push(e)}for(let i=0;i<n.length;){const o=gM(n,i),s=r[i],a=r[i+o];e.push(t.slice(s,a)),i+=o}return e},wM=e(mM);const bM=t=>{const e=Sf+t,r=Ef(n.Buffer.from(e,"utf8")).slice(2);return n.Buffer.from(r,"hex")},vM=(t,e,r)=>{const i=[t];e?i.push(e.toBuffer()):i.push(n.Buffer.alloc(32)),r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32));const[o]=Wo.findProgramAddressSync(i,kf);return o};async function _M(t,e){const r=bM(e.toBase58()),n=vM(r,Mf),{registry:i}=await oh.retrieve(t,n);if(!i.data)throw new Dc(exports.ErrorType.NoAccountData);const o=new ne(i.data.slice(0,4),"le").toNumber();return i.data.slice(4,4+o).toString()}async function EM(t,e){let r=[];for(let t of e){const e=bM(t.toBase58()),n=vM(e,Mf);r.push(n)}return(await oh.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;let e=new ne(t.data.slice(0,4),"le").toNumber();return t.data.slice(4,4+e).toString()}))}const kM=(t,e=xf,r)=>{let n=bM(t);return{pubkey:vM(n,r,e),hashed:n}},SM=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?bB:void 0,i=t.split(".");if(2===i.length){const t=n.Buffer.from([e||0]).toString().concat(i[0]),{pubkey:o}=kM(i[1]);return{...kM(t,o,r),isSub:!0,parent:o}}if(3===i.length&&e){const{pubkey:t}=kM(i[2]),{pubkey:n}=kM("\0".concat(i[1]),t),o=e===exports.RecordVersion.V2?"":"";return{...kM(o.concat(i[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(i.length>=3)throw new Dc(exports.ErrorType.InvalidInput);return{...kM(t,xf),isSub:!1,parent:void 0}};async function xM(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:xf.toBase58()}}];return(await t.getProgramAccounts(kf,{filters:r})).map((t=>t.pubkey))}const AM=(t,e)=>{const{pubkey:r,parent:n}=SM(t),i=bM(r.toBase58());return vM(i,Mf,e?n:void 0)},IM=(t,e)=>{const r=bM(t.toBase58());return vM(r,Mf,e)},BM=(t,e)=>{if(!t)throw new Dc(e)},MM=t=>{if(!t)return;const e=new ne(t.slice(0,4),"le").toNumber();return t.slice(4,4+e).toString()};var RM={},PM={};function TM(t,e,r,n,i){var o=(1<<n)-1,s=0,a=0,u=0;if(t.forEach((function(t){for(s=(s<<e)+t,a+=e;a>=n;)a-=n,r[u]=s>>a&o,u+=1})),i)a>0&&(r[u]=s<<n-a&o);else{if(a>=e)throw new Error("Excessive padding: ".concat(a," (max ").concat(e-1," allowed)"));if(s%(1<<a)!=0)throw new Error("Non-zero padding")}}Object.defineProperty(PM,"__esModule",{value:!0}),PM.createBitArray=function(t){return new Uint8Array(t)},PM.fromBits=function(t,e,r){if(e>8||e<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return TM(t,e,r,8,!1),r},PM.toBits=function(t,e,r){if(e>8||e<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return TM(t,8,r,e,!0),r};var OM={};Object.defineProperty(OM,"__esModule",{value:!0}),OM.CHECKSUM_LENGTH=void 0,OM.createChecksum=function(t,e){var r;switch(e){case"bech32":r=1;break;case"bech32m":r=CM;break;default:throw Error("Invalid encoding value: ".concat(e,"; expected bech32 or bech32m"))}for(var n=FM(t)^r,i=0;i<DM;i+=1){var o=5*(5-i);t[t.length-DM+i]=n>>o&31}},OM.decode=VM,OM.decodeWithPrefix=function(t,e){var r=e.length+2*t.length+1,n=(0,LM.createBitArray)(r);return KM(t,n.subarray(0,2*t.length+1)),VM(e,n.subarray(2*t.length+1)),n},OM.detectCase=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"message",r=!1,n=!1,i=0;i<t.length;i+=1){var o=t.charCodeAt(i);if(o<NM||o>zM)throw new TypeError("Invalid char in ".concat(e,": ").concat(o,"; ")+"should be in ASCII range ".concat(NM,"-").concat(zM));n=n||o>=65&&o<=90,r=r||o>=97&&o<=122}if(r&&n)throw new TypeError("Mixed-case ".concat(e));return n?"upper":r?"lower":null},OM.encode=function(t){return t.reduce((function(t,e){return t+UM[e]}),"")},OM.expandPrefix=KM,OM.verifyChecksum=function(t){switch(FM(t)){case 1:return"bech32";case CM:return"bech32m";default:return}};var LM=PM,UM="qpzry9x8gf2tvdw0s3jn54khce6mua7l",CM=734539939,NM=33,zM=126,DM=6;OM.CHECKSUM_LENGTH=DM;var jM=function(){for(var t=new Map,e=0;e<UM.length;e+=1)t.set(UM[e],e);return t}(),WM=[996825010,642813549,513874426,1027748829,705979059];function FM(t){return t.reduce((function(t,e){var r=t>>25,n=(33554431&t)<<5^e;return WM.reduce((function(t,e,n){return 0==(r>>n&1)?t:t^e}),n)}),1)}function KM(t,e){for(var r=0;r<t.length;r+=1){var n=t.charCodeAt(r);e[r]=n>>5,e[r+t.length+1]=31&n}e[t.length]=0}function VM(t,e){for(var r=e||(0,LM.createBitArray)(t.length),n=0;n<t.length;n+=1){var i=jM.get(t[n]);if(void 0===i)throw new Error("Invalid char in message: ".concat(t[n]));r[n]=i}return r}Object.defineProperty(RM,"__esModule",{value:!0}),RM.BitcoinAddress=void 0;var qM=RM.decode=function(t){var e=tR(t),r=e.prefix,n=e.encoding,i=e.data;return{prefix:r,encoding:n,data:XM(i)}};RM.decodeTo5BitArray=tR;var HM=RM.encode=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"bech32";return QM(t,JM(e),r)};RM.encode5BitArray=QM,RM.from5BitArray=XM,RM.to5BitArray=JM;var $M=PM,GM=OM;function ZM(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var YM=90;function JM(t,e){var r=Math.ceil(8*t.length/5),n=e||(0,$M.createBitArray)(r);return(0,$M.toBits)(t,5,n)}function XM(t,e){var r=Math.floor(5*t.length/8),n=e||new Uint8Array(r);return(0,$M.fromBits)(t,5,n)}function QM(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"bech32",i=2*t.length+1+e.length+GM.CHECKSUM_LENGTH;if(i-t.length>YM)throw new Error("Message to be produced is too long (max ".concat(YM," supported)"));var o=null!==(r=(0,GM.detectCase)(t,"prefix"))&&void 0!==r?r:"lower",s=(0,$M.createBitArray)(i);(0,GM.expandPrefix)(t.toLowerCase(),s.subarray(0,2*t.length+1)),s.subarray(2*t.length+1,s.length-GM.CHECKSUM_LENGTH).set(e),(0,GM.createChecksum)(s,n);var a=(0,GM.encode)(s.subarray(2*t.length+1));return"upper"===o&&(a=a.toUpperCase()),"".concat(t,"1").concat(a)}function tR(t){if(t.length>YM)throw new TypeError("Message too long; max ".concat(YM," expected"));(0,GM.detectCase)(t);var e=t.toLowerCase(),r=e.lastIndexOf("1");if(r<0)throw new Error('No separator char ("1") found');if(r>t.length-GM.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(GM.CHECKSUM_LENGTH," chars expected)"));var n=e.substring(0,r),i=(0,GM.decodeWithPrefix)(n,e.substring(r+1)),o=(0,GM.verifyChecksum)(i);if(void 0===o)throw new Error("Invalid checksum");return{prefix:n,encoding:o,data:i.subarray(2*n.length+1,i.length-GM.CHECKSUM_LENGTH)}}var eR=function(){function t(e,r,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"bc"!==e&&"tb"!==e)throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(r<0||r>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(n.length<2||n.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(0===r&&20!==n.length&&32!==n.length)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=e,this.scriptVersion=r,this.data=n}var e,r,n;return e=t,r=[{key:"type",value:function(){if(0===this.scriptVersion)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var t=Math.ceil(8*this.data.length/5),e=(0,$M.createBitArray)(t+1);e[0]=this.scriptVersion,JM(this.data,e.subarray(1));var r=0===this.scriptVersion?"bech32":"bech32m";return QM(this.prefix,e,r)}}],n=[{key:"decode",value:function(t){var e=tR(t),r=e.prefix,n=e.data,i=e.encoding;if("bc"!==r&&"tb"!==r)throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var o=n[0];if(0===o&&"bech32"!==i)throw Error("Unexpected encoding ".concat(i," used for version 0 script"));if(o>0&&"bech32m"!==i)throw Error("Unexpected encoding ".concat(i," used for version ").concat(o," script"));return new this(r,o,XM(n.subarray(1)))}}],r&&ZM(e.prototype,r),n&&ZM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();RM.BitcoinAddress=eR;var rR={exports:{}};!function(e){!function(t){const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${s})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(t.match(u.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 h(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 l(t){if(o.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(i.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function f(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 h(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,r,i;if(e=t.match(n.fourOctet))return function(){const t=e.slice(1,6),n=[];for(let e=0;e<t.length;e++)r=t[e],n.push(l(r));return n}();if(e=t.match(n.longValue)){if(i=l(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(n.twoOctet))?function(){const t=e.slice(1,4),r=[];if(i=l(t[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(e=t.match(n.threeOctet))?function(){const t=e.slice(1,5),r=[];if(i=l(t[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(l(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 h(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(f(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(u.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(u.native.test(t))return c(t,8);if((n=t.match(u.transitional))&&(s=n[6]||"",e=c(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},e.exports?e.exports=d:t.ipaddr=d}(t)}(rR);var nR=e(rR.exports);const iR=2147483647,oR=36,sR={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},aR=Math.floor,uR=String.fromCharCode;function cR(t){throw new RangeError(sR[t])}const hR=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},lR=function(t,e,r){let n=0;for(t=r?aR(t/700):t>>1,t+=aR(t/e);t>455;n+=oR)t=aR(t/35);return aR(n+36*t/(t+38))},fR=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(uR(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=iR;for(const e of t)e>=n&&e<r&&(r=e);const u=a+1;r-n>aR((iR-i)/u)&&cR("overflow"),i+=(r-n)*u,n=r;for(const r of t)if(r<n&&++i>iR&&cR("overflow"),r===n){let t=i;for(let r=oR;;r+=oR){const n=r<=o?1:r>=o+26?26:r-o;if(t<n)break;const i=t-n,s=oR-n;e.push(uR(hR(n+i%s,0))),t=aR(i/s)}e.push(uR(hR(t,0))),o=lR(i,u,a===s),i=0,++a}++i,++n}return e.join("")};function dR(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pR={exports:{}};!function(t){var e=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e<t.length;e++)r[e]=t[e];return r},r=function(){throw new Error("no PRNG")},n=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=e(),s=e([1]),a=e([56129,1]),u=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(t,e,r,n){t[e]=r>>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=n>>24&255,t[e+5]=n>>16&255,t[e+6]=n>>8&255,t[e+7]=255&n}function p(t,e,r,n,i){var o,s=0;for(o=0;o<i;o++)s|=t[e+o]^r[n+o];return(1&s-1>>>8)-1}function y(t,e,r,n){return p(t,e,r,n,16)}function g(t,e,r,n){return p(t,e,r,n,32)}function m(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,E=s,k=a,S=u,x=c,A=h,I=l,B=f,M=d,R=p,P=y,T=g,O=m,L=w,U=b,C=v,N=0;N<20;N+=2)_^=(i=(O^=(i=(M^=(i=(x^=(i=_+O|0)<<7|i>>>25)+_|0)<<9|i>>>23)+x|0)<<13|i>>>19)+M|0)<<18|i>>>14,A^=(i=(E^=(i=(L^=(i=(R^=(i=A+E|0)<<7|i>>>25)+A|0)<<9|i>>>23)+R|0)<<13|i>>>19)+L|0)<<18|i>>>14,P^=(i=(I^=(i=(k^=(i=(U^=(i=P+I|0)<<7|i>>>25)+P|0)<<9|i>>>23)+U|0)<<13|i>>>19)+k|0)<<18|i>>>14,C^=(i=(T^=(i=(B^=(i=(S^=(i=C+T|0)<<7|i>>>25)+C|0)<<9|i>>>23)+S|0)<<13|i>>>19)+B|0)<<18|i>>>14,_^=(i=(S^=(i=(k^=(i=(E^=(i=_+S|0)<<7|i>>>25)+_|0)<<9|i>>>23)+E|0)<<13|i>>>19)+k|0)<<18|i>>>14,A^=(i=(x^=(i=(B^=(i=(I^=(i=A+x|0)<<7|i>>>25)+A|0)<<9|i>>>23)+I|0)<<13|i>>>19)+B|0)<<18|i>>>14,P^=(i=(R^=(i=(M^=(i=(T^=(i=P+R|0)<<7|i>>>25)+P|0)<<9|i>>>23)+T|0)<<13|i>>>19)+M|0)<<18|i>>>14,C^=(i=(U^=(i=(L^=(i=(O^=(i=C+U|0)<<7|i>>>25)+C|0)<<9|i>>>23)+O|0)<<13|i>>>19)+L|0)<<18|i>>>14;_=_+o|0,E=E+s|0,k=k+a|0,S=S+u|0,x=x+c|0,A=A+h|0,I=I+l|0,B=B+f|0,M=M+d|0,R=R+p|0,P=P+y|0,T=T+g|0,O=O+m|0,L=L+w|0,U=U+b|0,C=C+v|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=E>>>0&255,t[5]=E>>>8&255,t[6]=E>>>16&255,t[7]=E>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=S>>>0&255,t[13]=S>>>8&255,t[14]=S>>>16&255,t[15]=S>>>24&255,t[16]=x>>>0&255,t[17]=x>>>8&255,t[18]=x>>>16&255,t[19]=x>>>24&255,t[20]=A>>>0&255,t[21]=A>>>8&255,t[22]=A>>>16&255,t[23]=A>>>24&255,t[24]=I>>>0&255,t[25]=I>>>8&255,t[26]=I>>>16&255,t[27]=I>>>24&255,t[28]=B>>>0&255,t[29]=B>>>8&255,t[30]=B>>>16&255,t[31]=B>>>24&255,t[32]=M>>>0&255,t[33]=M>>>8&255,t[34]=M>>>16&255,t[35]=M>>>24&255,t[36]=R>>>0&255,t[37]=R>>>8&255,t[38]=R>>>16&255,t[39]=R>>>24&255,t[40]=P>>>0&255,t[41]=P>>>8&255,t[42]=P>>>16&255,t[43]=P>>>24&255,t[44]=T>>>0&255,t[45]=T>>>8&255,t[46]=T>>>16&255,t[47]=T>>>24&255,t[48]=O>>>0&255,t[49]=O>>>8&255,t[50]=O>>>16&255,t[51]=O>>>24&255,t[52]=L>>>0&255,t[53]=L>>>8&255,t[54]=L>>>16&255,t[55]=L>>>24&255,t[56]=U>>>0&255,t[57]=U>>>8&255,t[58]=U>>>16&255,t[59]=U>>>24&255,t[60]=C>>>0&255,t[61]=C>>>8&255,t[62]=C>>>16&255,t[63]=C>>>24&255}(t,e,r,n)}function w(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(m^=(i=(d^=(i=(c^=(i=o+m|0)<<7|i>>>25)+o|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,h^=(i=(s^=(i=(w^=(i=(p^=(i=h+s|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+w|0)<<18|i>>>14,y^=(i=(l^=(i=(a^=(i=(b^=(i=y+l|0)<<7|i>>>25)+y|0)<<9|i>>>23)+b|0)<<13|i>>>19)+a|0)<<18|i>>>14,v^=(i=(g^=(i=(f^=(i=(u^=(i=v+g|0)<<7|i>>>25)+v|0)<<9|i>>>23)+u|0)<<13|i>>>19)+f|0)<<18|i>>>14,o^=(i=(u^=(i=(a^=(i=(s^=(i=o+u|0)<<7|i>>>25)+o|0)<<9|i>>>23)+s|0)<<13|i>>>19)+a|0)<<18|i>>>14,h^=(i=(c^=(i=(f^=(i=(l^=(i=h+c|0)<<7|i>>>25)+h|0)<<9|i>>>23)+l|0)<<13|i>>>19)+f|0)<<18|i>>>14,y^=(i=(p^=(i=(d^=(i=(g^=(i=y+p|0)<<7|i>>>25)+y|0)<<9|i>>>23)+g|0)<<13|i>>>19)+d|0)<<18|i>>>14,v^=(i=(b^=(i=(w^=(i=(m^=(i=v+b|0)<<7|i>>>25)+v|0)<<9|i>>>23)+m|0)<<13|i>>>19)+w|0)<<18|i>>>14;t[0]=o>>>0&255,t[1]=o>>>8&255,t[2]=o>>>16&255,t[3]=o>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=v>>>0&255,t[13]=v>>>8&255,t[14]=v>>>16&255,t[15]=v>>>24&255,t[16]=l>>>0&255,t[17]=l>>>8&255,t[18]=l>>>16&255,t[19]=l>>>24&255,t[20]=f>>>0&255,t[21]=f>>>8&255,t[22]=f>>>16&255,t[23]=f>>>24&255,t[24]=d>>>0&255,t[25]=d>>>8&255,t[26]=d>>>16&255,t[27]=d>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function v(t,e,r,n,i,o,s){var a,u,c=new Uint8Array(16),h=new Uint8Array(64);for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=o[u];for(;i>=64;){for(m(h,c,s,b),u=0;u<64;u++)t[e+u]=r[n+u]^h[u];for(a=1,u=8;u<16;u++)a=a+(255&c[u])|0,c[u]=255&a,a>>>=8;i-=64,e+=64,n+=64}if(i>0)for(m(h,c,s,b),u=0;u<i;u++)t[e+u]=r[n+u]^h[u];return 0}function _(t,e,r,n,i){var o,s,a=new Uint8Array(16),u=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=n[s];for(;r>=64;){for(m(u,a,i,b),s=0;s<64;s++)t[e+s]=u[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,e+=64}if(r>0)for(m(u,a,i,b),s=0;s<r;s++)t[e+s]=u[s];return 0}function E(t,e,r,n,i){var o=new Uint8Array(32);w(o,n,i,b);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=n[a+16];return _(t,e,r,s,o)}function k(t,e,r,n,i,o,s){var a=new Uint8Array(32);w(a,o,s,b);for(var u=new Uint8Array(8),c=0;c<8;c++)u[c]=o[c+16];return v(t,e,r,n,i,u,a)}var S=function(t){var e,r,n,i,o,s,a,u;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,e=255&t[0]|(255&t[1])<<8,this.r[0]=8191&e,r=255&t[2]|(255&t[3])<<8,this.r[1]=8191&(e>>>13|r<<3),n=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&t[8]|(255&t[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function x(t,e,r,n,i,o){var s=new S(o);return s.update(r,n,i),s.finish(t,e),0}function A(t,e,r,n,i,o){var s=new Uint8Array(16);return x(s,0,r,n,i,o),y(t,e,s,0)}function I(t,e,r,n,i){var o;if(r<32)return-1;for(k(t,0,e,0,r,n,i),x(t,16,t,32,r-32,t),o=0;o<16;o++)t[o]=0;return 0}function B(t,e,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(E(s,0,32,n,i),0!==A(e,16,e,32,r-32,s))return-1;for(k(t,0,e,0,r,n,i),o=0;o<32;o++)t[o]=0;return 0}function M(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function R(t){var e,r,n=1;for(e=0;e<16;e++)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function P(t,e,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(t[o]^e[o]),t[o]^=n,e[o]^=n}function T(t,r){var n,i,o,s=e(),a=e();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,P(a,s,1-o)}for(n=0;n<16;n++)t[2*n]=255&a[n],t[2*n+1]=a[n]>>8}function O(t,e){var r=new Uint8Array(32),n=new Uint8Array(32);return T(r,t),T(n,e),g(r,0,n,0)}function L(t){var e=new Uint8Array(32);return T(e,t),1&e[0]}function U(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function C(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function N(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function z(t,e,r){var n,i,o=0,s=0,a=0,u=0,c=0,h=0,l=0,f=0,d=0,p=0,y=0,g=0,m=0,w=0,b=0,v=0,_=0,E=0,k=0,S=0,x=0,A=0,I=0,B=0,M=0,R=0,P=0,T=0,O=0,L=0,U=0,C=r[0],N=r[1],z=r[2],D=r[3],j=r[4],W=r[5],F=r[6],K=r[7],V=r[8],q=r[9],H=r[10],$=r[11],G=r[12],Z=r[13],Y=r[14],J=r[15];o+=(n=e[0])*C,s+=n*N,a+=n*z,u+=n*D,c+=n*j,h+=n*W,l+=n*F,f+=n*K,d+=n*V,p+=n*q,y+=n*H,g+=n*$,m+=n*G,w+=n*Z,b+=n*Y,v+=n*J,s+=(n=e[1])*C,a+=n*N,u+=n*z,c+=n*D,h+=n*j,l+=n*W,f+=n*F,d+=n*K,p+=n*V,y+=n*q,g+=n*H,m+=n*$,w+=n*G,b+=n*Z,v+=n*Y,_+=n*J,a+=(n=e[2])*C,u+=n*N,c+=n*z,h+=n*D,l+=n*j,f+=n*W,d+=n*F,p+=n*K,y+=n*V,g+=n*q,m+=n*H,w+=n*$,b+=n*G,v+=n*Z,_+=n*Y,E+=n*J,u+=(n=e[3])*C,c+=n*N,h+=n*z,l+=n*D,f+=n*j,d+=n*W,p+=n*F,y+=n*K,g+=n*V,m+=n*q,w+=n*H,b+=n*$,v+=n*G,_+=n*Z,E+=n*Y,k+=n*J,c+=(n=e[4])*C,h+=n*N,l+=n*z,f+=n*D,d+=n*j,p+=n*W,y+=n*F,g+=n*K,m+=n*V,w+=n*q,b+=n*H,v+=n*$,_+=n*G,E+=n*Z,k+=n*Y,S+=n*J,h+=(n=e[5])*C,l+=n*N,f+=n*z,d+=n*D,p+=n*j,y+=n*W,g+=n*F,m+=n*K,w+=n*V,b+=n*q,v+=n*H,_+=n*$,E+=n*G,k+=n*Z,S+=n*Y,x+=n*J,l+=(n=e[6])*C,f+=n*N,d+=n*z,p+=n*D,y+=n*j,g+=n*W,m+=n*F,w+=n*K,b+=n*V,v+=n*q,_+=n*H,E+=n*$,k+=n*G,S+=n*Z,x+=n*Y,A+=n*J,f+=(n=e[7])*C,d+=n*N,p+=n*z,y+=n*D,g+=n*j,m+=n*W,w+=n*F,b+=n*K,v+=n*V,_+=n*q,E+=n*H,k+=n*$,S+=n*G,x+=n*Z,A+=n*Y,I+=n*J,d+=(n=e[8])*C,p+=n*N,y+=n*z,g+=n*D,m+=n*j,w+=n*W,b+=n*F,v+=n*K,_+=n*V,E+=n*q,k+=n*H,S+=n*$,x+=n*G,A+=n*Z,I+=n*Y,B+=n*J,p+=(n=e[9])*C,y+=n*N,g+=n*z,m+=n*D,w+=n*j,b+=n*W,v+=n*F,_+=n*K,E+=n*V,k+=n*q,S+=n*H,x+=n*$,A+=n*G,I+=n*Z,B+=n*Y,M+=n*J,y+=(n=e[10])*C,g+=n*N,m+=n*z,w+=n*D,b+=n*j,v+=n*W,_+=n*F,E+=n*K,k+=n*V,S+=n*q,x+=n*H,A+=n*$,I+=n*G,B+=n*Z,M+=n*Y,R+=n*J,g+=(n=e[11])*C,m+=n*N,w+=n*z,b+=n*D,v+=n*j,_+=n*W,E+=n*F,k+=n*K,S+=n*V,x+=n*q,A+=n*H,I+=n*$,B+=n*G,M+=n*Z,R+=n*Y,P+=n*J,m+=(n=e[12])*C,w+=n*N,b+=n*z,v+=n*D,_+=n*j,E+=n*W,k+=n*F,S+=n*K,x+=n*V,A+=n*q,I+=n*H,B+=n*$,M+=n*G,R+=n*Z,P+=n*Y,T+=n*J,w+=(n=e[13])*C,b+=n*N,v+=n*z,_+=n*D,E+=n*j,k+=n*W,S+=n*F,x+=n*K,A+=n*V,I+=n*q,B+=n*H,M+=n*$,R+=n*G,P+=n*Z,T+=n*Y,O+=n*J,b+=(n=e[14])*C,v+=n*N,_+=n*z,E+=n*D,k+=n*j,S+=n*W,x+=n*F,A+=n*K,I+=n*V,B+=n*q,M+=n*H,R+=n*$,P+=n*G,T+=n*Z,O+=n*Y,L+=n*J,v+=(n=e[15])*C,s+=38*(E+=n*z),a+=38*(k+=n*D),u+=38*(S+=n*j),c+=38*(x+=n*W),h+=38*(A+=n*F),l+=38*(I+=n*K),f+=38*(B+=n*V),d+=38*(M+=n*q),p+=38*(R+=n*H),y+=38*(P+=n*$),g+=38*(T+=n*G),m+=38*(O+=n*Z),w+=38*(L+=n*Y),b+=38*(U+=n*J),o=(n=(o+=38*(_+=n*N))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),t[0]=o,t[1]=s,t[2]=a,t[3]=u,t[4]=c,t[5]=h,t[6]=l,t[7]=f,t[8]=d,t[9]=p,t[10]=y,t[11]=g,t[12]=m,t[13]=w,t[14]=b,t[15]=v}function D(t,e){z(t,e,e)}function j(t,r){var n,i=e();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)D(i,i),2!==n&&4!==n&&z(i,i,r);for(n=0;n<16;n++)t[n]=i[n]}function W(t,r){var n,i=e();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)D(i,i),1!==n&&z(i,i,r);for(n=0;n<16;n++)t[n]=i[n]}function F(t,r,n){var i,o,s=new Uint8Array(32),u=new Float64Array(80),c=e(),h=e(),l=e(),f=e(),d=e(),p=e();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,U(u,n),o=0;o<16;o++)h[o]=u[o],f[o]=c[o]=l[o]=0;for(c[0]=f[0]=1,o=254;o>=0;--o)P(c,h,i=s[o>>>3]>>>(7&o)&1),P(l,f,i),C(d,c,l),N(c,c,l),C(l,h,f),N(h,h,f),D(f,d),D(p,c),z(c,l,c),z(l,h,d),C(d,c,l),N(c,c,l),D(h,c),N(l,f,p),z(c,l,a),C(c,c,f),z(l,l,c),z(c,f,p),z(f,h,u),D(h,d),P(c,h,i),P(l,f,i);for(o=0;o<16;o++)u[o+16]=c[o],u[o+32]=l[o],u[o+48]=h[o],u[o+64]=f[o];var y=u.subarray(32),g=u.subarray(16);return j(y,y),z(g,g,y),T(t,g),0}function K(t,e){return F(t,e,i)}function V(t,e){return r(e,32),K(t,e)}function q(t,e,r){var i=new Uint8Array(32);return F(i,r,e),w(t,n,i,b)}S.prototype.blocks=function(t,e,r){for(var n,i,o,s,a,u,c,h,l,f,d,p,y,g,m,w,b,v,_,E=this.fin?0:2048,k=this.h[0],S=this.h[1],x=this.h[2],A=this.h[3],I=this.h[4],B=this.h[5],M=this.h[6],R=this.h[7],P=this.h[8],T=this.h[9],O=this.r[0],L=this.r[1],U=this.r[2],C=this.r[3],N=this.r[4],z=this.r[5],D=this.r[6],j=this.r[7],W=this.r[8],F=this.r[9];r>=16;)f=l=0,f+=(k+=8191&(n=255&t[e+0]|(255&t[e+1])<<8))*O,f+=(S+=8191&(n>>>13|(i=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*F),f+=(x+=8191&(i>>>10|(o=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*W),f+=(A+=8191&(o>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*j),l=(f+=(I+=8191&(s>>>4|(a=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*D))>>>13,f&=8191,f+=(B+=a>>>1&8191)*(5*z),f+=(M+=8191&(a>>>14|(u=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),f+=(R+=8191&(u>>>11|(c=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*C),f+=(P+=8191&(c>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*U),d=l+=(f+=(T+=h>>>5|E)*(5*L))>>>13,d+=k*L,d+=S*O,d+=x*(5*F),d+=A*(5*W),l=(d+=I*(5*j))>>>13,d&=8191,d+=B*(5*D),d+=M*(5*z),d+=R*(5*N),d+=P*(5*C),l+=(d+=T*(5*U))>>>13,d&=8191,p=l,p+=k*U,p+=S*L,p+=x*O,p+=A*(5*F),l=(p+=I*(5*W))>>>13,p&=8191,p+=B*(5*j),p+=M*(5*D),p+=R*(5*z),p+=P*(5*N),y=l+=(p+=T*(5*C))>>>13,y+=k*C,y+=S*U,y+=x*L,y+=A*O,l=(y+=I*(5*F))>>>13,y&=8191,y+=B*(5*W),y+=M*(5*j),y+=R*(5*D),y+=P*(5*z),g=l+=(y+=T*(5*N))>>>13,g+=k*N,g+=S*C,g+=x*U,g+=A*L,l=(g+=I*O)>>>13,g&=8191,g+=B*(5*F),g+=M*(5*W),g+=R*(5*j),g+=P*(5*D),m=l+=(g+=T*(5*z))>>>13,m+=k*z,m+=S*N,m+=x*C,m+=A*U,l=(m+=I*L)>>>13,m&=8191,m+=B*O,m+=M*(5*F),m+=R*(5*W),m+=P*(5*j),w=l+=(m+=T*(5*D))>>>13,w+=k*D,w+=S*z,w+=x*N,w+=A*C,l=(w+=I*U)>>>13,w&=8191,w+=B*L,w+=M*O,w+=R*(5*F),w+=P*(5*W),b=l+=(w+=T*(5*j))>>>13,b+=k*j,b+=S*D,b+=x*z,b+=A*N,l=(b+=I*C)>>>13,b&=8191,b+=B*U,b+=M*L,b+=R*O,b+=P*(5*F),v=l+=(b+=T*(5*W))>>>13,v+=k*W,v+=S*j,v+=x*D,v+=A*z,l=(v+=I*N)>>>13,v&=8191,v+=B*C,v+=M*U,v+=R*L,v+=P*O,_=l+=(v+=T*(5*F))>>>13,_+=k*F,_+=S*W,_+=x*j,_+=A*D,l=(_+=I*z)>>>13,_&=8191,_+=B*N,_+=M*C,_+=R*U,_+=P*L,k=f=8191&(l=(l=((l+=(_+=T*O)>>>13)<<2)+l|0)+(f&=8191)|0),S=d+=l>>>=13,x=p&=8191,A=y&=8191,I=g&=8191,B=m&=8191,M=w&=8191,R=b&=8191,P=v&=8191,T=_&=8191,e+=16,r-=16;this.h[0]=k,this.h[1]=S,this.h[2]=x,this.h[3]=A,this.h[4]=I,this.h[5]=B,this.h[6]=M,this.h[7]=R,this.h[8]=P,this.h[9]=T},S.prototype.finish=function(t,e){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},S.prototype.update=function(t,e,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n<i;n++)this.buffer[this.leftover+n]=t[e+n];if(r-=i,e+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(i=r-r%16,this.blocks(t,e,i),e+=i,r-=i),r){for(n=0;n<r;n++)this.buffer[this.leftover+n]=t[e+n];this.leftover+=r}};var H=I,$=B,G=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Z(t,e,r,n){for(var i,o,s,a,u,c,h,l,f,d,p,y,g,m,w,b,v,_,E,k,S,x,A,I,B,M,R=new Int32Array(16),P=new Int32Array(16),T=t[0],O=t[1],L=t[2],U=t[3],C=t[4],N=t[5],z=t[6],D=t[7],j=e[0],W=e[1],F=e[2],K=e[3],V=e[4],q=e[5],H=e[6],$=e[7],Z=0;n>=128;){for(E=0;E<16;E++)k=8*E+Z,R[E]=r[k+0]<<24|r[k+1]<<16|r[k+2]<<8|r[k+3],P[E]=r[k+4]<<24|r[k+5]<<16|r[k+6]<<8|r[k+7];for(E=0;E<80;E++)if(i=T,o=O,s=L,a=U,u=C,c=N,h=z,f=j,d=W,p=F,y=K,g=V,m=q,w=H,A=65535&(x=$),I=x>>>16,B=65535&(S=D),M=S>>>16,A+=65535&(x=(V>>>14|C<<18)^(V>>>18|C<<14)^(C>>>9|V<<23)),I+=x>>>16,B+=65535&(S=(C>>>14|V<<18)^(C>>>18|V<<14)^(V>>>9|C<<23)),M+=S>>>16,A+=65535&(x=V&q^~V&H),I+=x>>>16,B+=65535&(S=C&N^~C&z),M+=S>>>16,S=G[2*E],A+=65535&(x=G[2*E+1]),I+=x>>>16,B+=65535&S,M+=S>>>16,S=R[E%16],I+=(x=P[E%16])>>>16,B+=65535&S,M+=S>>>16,B+=(I+=(A+=65535&x)>>>16)>>>16,A=65535&(x=_=65535&A|I<<16),I=x>>>16,B=65535&(S=v=65535&B|(M+=B>>>16)<<16),M=S>>>16,A+=65535&(x=(j>>>28|T<<4)^(T>>>2|j<<30)^(T>>>7|j<<25)),I+=x>>>16,B+=65535&(S=(T>>>28|j<<4)^(j>>>2|T<<30)^(j>>>7|T<<25)),M+=S>>>16,I+=(x=j&W^j&F^W&F)>>>16,B+=65535&(S=T&O^T&L^O&L),M+=S>>>16,l=65535&(B+=(I+=(A+=65535&x)>>>16)>>>16)|(M+=B>>>16)<<16,b=65535&A|I<<16,A=65535&(x=y),I=x>>>16,B=65535&(S=a),M=S>>>16,I+=(x=_)>>>16,B+=65535&(S=v),M+=S>>>16,O=i,L=o,U=s,C=a=65535&(B+=(I+=(A+=65535&x)>>>16)>>>16)|(M+=B>>>16)<<16,N=u,z=c,D=h,T=l,W=f,F=d,K=p,V=y=65535&A|I<<16,q=g,H=m,$=w,j=b,E%16==15)for(k=0;k<16;k++)S=R[k],A=65535&(x=P[k]),I=x>>>16,B=65535&S,M=S>>>16,S=R[(k+9)%16],A+=65535&(x=P[(k+9)%16]),I+=x>>>16,B+=65535&S,M+=S>>>16,v=R[(k+1)%16],A+=65535&(x=((_=P[(k+1)%16])>>>1|v<<31)^(_>>>8|v<<24)^(_>>>7|v<<25)),I+=x>>>16,B+=65535&(S=(v>>>1|_<<31)^(v>>>8|_<<24)^v>>>7),M+=S>>>16,v=R[(k+14)%16],I+=(x=((_=P[(k+14)%16])>>>19|v<<13)^(v>>>29|_<<3)^(_>>>6|v<<26))>>>16,B+=65535&(S=(v>>>19|_<<13)^(_>>>29|v<<3)^v>>>6),M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,R[k]=65535&B|M<<16,P[k]=65535&A|I<<16;A=65535&(x=j),I=x>>>16,B=65535&(S=T),M=S>>>16,S=t[0],I+=(x=e[0])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[0]=T=65535&B|M<<16,e[0]=j=65535&A|I<<16,A=65535&(x=W),I=x>>>16,B=65535&(S=O),M=S>>>16,S=t[1],I+=(x=e[1])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[1]=O=65535&B|M<<16,e[1]=W=65535&A|I<<16,A=65535&(x=F),I=x>>>16,B=65535&(S=L),M=S>>>16,S=t[2],I+=(x=e[2])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[2]=L=65535&B|M<<16,e[2]=F=65535&A|I<<16,A=65535&(x=K),I=x>>>16,B=65535&(S=U),M=S>>>16,S=t[3],I+=(x=e[3])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[3]=U=65535&B|M<<16,e[3]=K=65535&A|I<<16,A=65535&(x=V),I=x>>>16,B=65535&(S=C),M=S>>>16,S=t[4],I+=(x=e[4])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[4]=C=65535&B|M<<16,e[4]=V=65535&A|I<<16,A=65535&(x=q),I=x>>>16,B=65535&(S=N),M=S>>>16,S=t[5],I+=(x=e[5])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[5]=N=65535&B|M<<16,e[5]=q=65535&A|I<<16,A=65535&(x=H),I=x>>>16,B=65535&(S=z),M=S>>>16,S=t[6],I+=(x=e[6])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[6]=z=65535&B|M<<16,e[6]=H=65535&A|I<<16,A=65535&(x=$),I=x>>>16,B=65535&(S=D),M=S>>>16,S=t[7],I+=(x=e[7])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[7]=D=65535&B|M<<16,e[7]=$=65535&A|I<<16,Z+=128,n-=128}return n}function Y(t,e,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,Z(i,o,e,r),r%=128,n=0;n<r;n++)s[n]=e[a-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,d(s,r-8,a/536870912|0,a<<3),Z(i,o,s,r),n=0;n<8;n++)d(t,8*n,i[n],o[n]);return 0}function J(t,r){var n=e(),i=e(),o=e(),s=e(),a=e(),u=e(),h=e(),l=e(),f=e();N(n,t[1],t[0]),N(f,r[1],r[0]),z(n,n,f),C(i,t[0],t[1]),C(f,r[0],r[1]),z(i,i,f),z(o,t[3],r[3]),z(o,o,c),z(s,t[2],r[2]),C(s,s,s),N(a,i,n),N(u,s,o),C(h,s,o),C(l,i,n),z(t[0],a,u),z(t[1],l,h),z(t[2],h,u),z(t[3],a,l)}function X(t,e,r){var n;for(n=0;n<4;n++)P(t[n],e[n],r)}function Q(t,r){var n=e(),i=e(),o=e();j(o,r[2]),z(n,r[0],o),z(i,r[1],o),T(t,i),t[31]^=L(n)<<7}function tt(t,e,r){var n,i;for(M(t[0],o),M(t[1],s),M(t[2],s),M(t[3],o),i=255;i>=0;--i)X(t,e,n=r[i/8|0]>>(7&i)&1),J(e,t),J(t,t),X(t,e,n)}function et(t,r){var n=[e(),e(),e(),e()];M(n[0],h),M(n[1],l),M(n[2],s),z(n[3],h,l),tt(t,n,r)}function rt(t,n,i){var o,s=new Uint8Array(64),a=[e(),e(),e(),e()];for(i||r(n,32),Y(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,et(a,s),Q(t,a),o=0;o<32;o++)n[o+32]=t[o];return 0}var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(t,e){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)e[i]+=r-16*e[n]*nt[i-(n-32)],r=Math.floor((e[i]+128)/256),e[i]-=256*r;e[i]+=r,e[n]=0}for(r=0,i=0;i<32;i++)e[i]+=r-(e[31]>>4)*nt[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*nt[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function ot(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;it(t,r)}function st(t,r,n,i){var o,s,a=new Uint8Array(64),u=new Uint8Array(64),c=new Uint8Array(64),h=new Float64Array(64),l=[e(),e(),e(),e()];Y(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(o=0;o<n;o++)t[64+o]=r[o];for(o=0;o<32;o++)t[32+o]=a[32+o];for(Y(c,t.subarray(32),n+32),ot(c),et(l,c),Q(t,l),o=32;o<64;o++)t[o]=i[o];for(Y(u,t,n+64),ot(u),o=0;o<64;o++)h[o]=0;for(o=0;o<32;o++)h[o]=c[o];for(o=0;o<32;o++)for(s=0;s<32;s++)h[o+s]+=u[o]*a[s];return it(t.subarray(32),h),f}function at(t,r,n,i){var a,c=new Uint8Array(32),h=new Uint8Array(64),l=[e(),e(),e(),e()],d=[e(),e(),e(),e()];if(n<64)return-1;if(function(t,r){var n=e(),i=e(),a=e(),c=e(),h=e(),l=e(),d=e();return M(t[2],s),U(t[1],r),D(a,t[1]),z(c,a,u),N(a,a,t[2]),C(c,t[2],c),D(h,c),D(l,h),z(d,l,h),z(n,d,a),z(n,n,c),W(n,n),z(n,n,a),z(n,n,c),z(n,n,c),z(t[0],n,c),D(i,t[0]),z(i,i,c),O(i,a)&&z(t[0],t[0],f),D(i,t[0]),z(i,i,c),O(i,a)?-1:(L(t[0])===r[31]>>7&&N(t[0],o,t[0]),z(t[3],t[0],t[1]),0)}(d,i))return-1;for(a=0;a<n;a++)t[a]=r[a];for(a=0;a<32;a++)t[a+32]=i[a];if(Y(h,t,n),ot(h),tt(l,d,h),et(d,r.subarray(32)),J(l,d),Q(c,l),n-=64,g(r,0,c,0)){for(a=0;a<n;a++)t[a]=0;return-1}for(a=0;a<n;a++)t[a]=r[a+64];return n}var ut=16,ct=64,ht=32,lt=64;function ft(t,e){if(32!==t.length)throw new Error("bad key size");if(24!==e.length)throw new Error("bad nonce size")}function dt(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function pt(t){for(var e=0;e<t.length;e++)t[e]=0}t.lowlevel={crypto_core_hsalsa20:w,crypto_stream_xor:k,crypto_stream:E,crypto_stream_salsa20_xor:v,crypto_stream_salsa20:_,crypto_onetimeauth:x,crypto_onetimeauth_verify:A,crypto_verify_16:y,crypto_verify_32:g,crypto_secretbox:I,crypto_secretbox_open:B,crypto_scalarmult:F,crypto_scalarmult_base:K,crypto_box_beforenm:q,crypto_box_afternm:H,crypto_box:function(t,e,r,n,i,o){var s=new Uint8Array(32);return q(s,i,o),H(t,e,r,n,s)},crypto_box_open:function(t,e,r,n,i,o){var s=new Uint8Array(32);return q(s,i,o),$(t,e,r,n,s)},crypto_box_keypair:V,crypto_hash:Y,crypto_sign:st,crypto_sign_keypair:rt,crypto_sign_open:at,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ut,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:ct,crypto_sign_PUBLICKEYBYTES:ht,crypto_sign_SECRETKEYBYTES:lt,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:e,D:u,L:nt,pack25519:T,unpack25519:U,M:z,A:C,S:D,Z:N,pow2523:W,add:J,set25519:M,modL:it,scalarmult:tt,scalarbase:et},t.randomBytes=function(t){var e=new Uint8Array(t);return r(e,t),e},t.secretbox=function(t,e,r){dt(t,e,r),ft(r,e);for(var n=new Uint8Array(32+t.length),i=new Uint8Array(n.length),o=0;o<t.length;o++)n[o+32]=t[o];return I(i,n,n.length,e,r),i.subarray(ut)},t.secretbox.open=function(t,e,r){dt(t,e,r),ft(r,e);for(var n=new Uint8Array(ut+t.length),i=new Uint8Array(n.length),o=0;o<t.length;o++)n[o+ut]=t[o];return n.length<32||0!==B(i,n,n.length,e,r)?null:i.subarray(32)},t.secretbox.keyLength=32,t.secretbox.nonceLength=24,t.secretbox.overheadLength=ut,t.scalarMult=function(t,e){if(dt(t,e),32!==t.length)throw new Error("bad n size");if(32!==e.length)throw new Error("bad p size");var r=new Uint8Array(32);return F(r,t,e),r},t.scalarMult.base=function(t){if(dt(t),32!==t.length)throw new Error("bad n size");var e=new Uint8Array(32);return K(e,t),e},t.scalarMult.scalarLength=32,t.scalarMult.groupElementLength=32,t.box=function(e,r,n,i){var o=t.box.before(n,i);return t.secretbox(e,r,o)},t.box.before=function(t,e){dt(t,e),function(t,e){if(32!==t.length)throw new Error("bad public key size");if(32!==e.length)throw new Error("bad secret key size")}(t,e);var r=new Uint8Array(32);return q(r,t,e),r},t.box.after=t.secretbox,t.box.open=function(e,r,n,i){var o=t.box.before(n,i);return t.secretbox.open(e,r,o)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(32);return V(t,e),{publicKey:t,secretKey:e}},t.box.keyPair.fromSecretKey=function(t){if(dt(t),32!==t.length)throw new Error("bad secret key size");var e=new Uint8Array(32);return K(e,t),{publicKey:e,secretKey:new Uint8Array(t)}},t.box.publicKeyLength=32,t.box.secretKeyLength=32,t.box.sharedKeyLength=32,t.box.nonceLength=24,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(t,e){if(dt(t,e),e.length!==lt)throw new Error("bad secret key size");var r=new Uint8Array(ct+t.length);return st(r,t,t.length,e),r},t.sign.open=function(t,e){if(dt(t,e),e.length!==ht)throw new Error("bad public key size");var r=new Uint8Array(t.length),n=at(r,t,t.length,e);if(n<0)return null;for(var i=new Uint8Array(n),o=0;o<i.length;o++)i[o]=r[o];return i},t.sign.detached=function(e,r){for(var n=t.sign(e,r),i=new Uint8Array(ct),o=0;o<i.length;o++)i[o]=n[o];return i},t.sign.detached.verify=function(t,e,r){if(dt(t,e,r),e.length!==ct)throw new Error("bad signature size");if(r.length!==ht)throw new Error("bad public key size");var n,i=new Uint8Array(ct+t.length),o=new Uint8Array(ct+t.length);for(n=0;n<ct;n++)i[n]=e[n];for(n=0;n<t.length;n++)i[n+ct]=t[n];return at(o,i,i.length,r)>=0},t.sign.keyPair=function(){var t=new Uint8Array(ht),e=new Uint8Array(lt);return rt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(dt(t),t.length!==lt)throw new Error("bad secret key size");for(var e=new Uint8Array(ht),r=0;r<e.length;r++)e[r]=t[32+r];return{publicKey:e,secretKey:new Uint8Array(t)}},t.sign.keyPair.fromSeed=function(t){if(dt(t),32!==t.length)throw new Error("bad seed size");for(var e=new Uint8Array(ht),r=new Uint8Array(lt),n=0;n<32;n++)r[n]=t[n];return rt(e,r,!0),{publicKey:e,secretKey:r}},t.sign.publicKeyLength=ht,t.sign.secretKeyLength=lt,t.sign.seedLength=32,t.sign.signatureLength=ct,t.hash=function(t){dt(t);var e=new Uint8Array(64);return Y(e,t,t.length),e},t.hash.hashLength=64,t.verify=function(t,e){return dt(t,e),0!==t.length&&0!==e.length&&t.length===e.length&&0===p(t,0,e,0,t.length)},t.setPRNG=function(t){r=t},function(){var e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&e.getRandomValues?t.setPRNG((function(t,r){var n,i=new Uint8Array(r);for(n=0;n<r;n+=65536)e.getRandomValues(i.subarray(n,n+Math.min(r-n,65536)));for(n=0;n<r;n++)t[n]=i[n];pt(i)})):void 0!==dR&&(e=ee)&&e.randomBytes&&t.setPRNG((function(t,r){var n,i=e.randomBytes(r);for(n=0;n<r;n++)t[n]=i[n];pt(i)}))}()}(pR.exports?pR.exports:self.nacl=self.nacl||{});var yR=pR.exports;const gR=(t,e,r)=>yR.sign.detached.verify(t,e,r.toBytes()),mR=(t,e)=>{const{pubkey:r}=SM(e+"."+t,exports.RecordVersion.V1);return r};async function wR(t,e,r,n){const i=mR(e,r);let{registry:o}=await oh.retrieve(t,i);if(!o.data)throw new Dc(exports.ErrorType.NoRecordData);if(n)return vR(o,r,i);const s=xB.get(r);return o.data=o.data.slice(0,s),o}const bR=async(t,e)=>await wR(t,e,exports.Record.SOL),vR=(t,e,r)=>{const i=null==t?void 0:t.data;if(!i)return;if(0===i.compare(n.Buffer.alloc(i.length)))return;const o=xB.get(e),s=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!o)return i.slice(0,s).toString("utf-8");if(e===exports.Record.SOL){const e=new TextEncoder,o=n.Buffer.concat([i.slice(0,32),r.toBuffer()]),s=e.encode(o.toString("hex"));if(gR(s,i.slice(32,96),t.owner))return Uv.encode(i.slice(0,32))}if(o&&s!==o){const t=i.slice(0,s).toString("utf-8");if(e===exports.Record.Injective){const e=qM(t);if("inj"===e.prefix&&20===e.data.length)return t}else if(e===exports.Record.BSC||e===exports.Record.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===n.Buffer.from(r,"hex").length)return t}else if((e===exports.Record.A||e===exports.Record.AAAA)&&nR.isValid(t))return t;throw new Dc(exports.ErrorType.InvalidRecordData)}if(e===exports.Record.ETH||e===exports.Record.BSC)return"0x"+i.slice(0,o).toString("hex");if(e===exports.Record.Injective)return HM("inj",i.slice(0,o),"bech32");if(e===exports.Record.A||e===exports.Record.AAAA)return nR.fromByteArray([...i.slice(0,o)]).toString();if(e===exports.Record.Background)return new Wo(i.slice(0,o)).toString();throw new Dc(exports.ErrorType.InvalidRecordData)},_R=(t,e)=>{if(!xB.get(e))return e!==exports.Record.CNAME&&e!==exports.Record.TXT||(t=fR(t)),n.Buffer.from(t,"utf-8");if(e===exports.Record.SOL)throw new Dc(exports.ErrorType.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(e===exports.Record.ETH||e===exports.Record.BSC)return BM("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(t.slice(2),"hex");if(e===exports.Record.Injective){const e=qM(t);return BM("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),BM(20===e.data.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(e.data)}if(e===exports.Record.A){const e=nR.parse(t).toByteArray();return BM(4===e.length,exports.ErrorType.InvalidARecord),n.Buffer.from(e)}if(e===exports.Record.AAAA){const e=nR.parse(t).toByteArray();return BM(16===e.length,exports.ErrorType.InvalidAAAARecord),n.Buffer.from(e)}if(e===exports.Record.Background)return new Wo(t).toBuffer();throw new Dc(exports.ErrorType.InvalidRecordInput)},ER=(t,e,r,i)=>{const o=n.Buffer.concat([t.toBuffer(),e.toBuffer()]),s=(new TextEncoder).encode(o.toString("hex")),a=gR(s,i,r);return BM(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([t.toBuffer(),i])},kR=new Map([[exports.Record.Url,new Wo("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),SR=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC]),xR=new Set([exports.Record.IPFS,exports.Record.ARWV,exports.Record.LTC,exports.Record.DOGE,exports.Record.Email,exports.Record.Url,exports.Record.Discord,exports.Record.Github,exports.Record.Reddit,exports.Record.Twitter,exports.Record.Telegram,exports.Record.Pic,exports.Record.SHDW,exports.Record.POINT,exports.Record.Backpack,exports.Record.TXT,exports.Record.CNAME,exports.Record.BTC]),AR=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),IR=(t,e)=>{if(xR.has(e)){const r=t.toString("utf-8");return e===exports.Record.CNAME||e===exports.Record.TXT?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&&cR("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=oR;;i+=oR){u>=r&&cR("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:oR;s>=oR&&cR("invalid-input"),s>aR((iR-n)/e)&&cR("overflow"),n+=s*e;const c=i<=o?1:i>=o+26?26:i-o;if(s<c)break;const h=oR-c;e>aR(iR/h)&&cR("overflow"),e*=h}const c=e.length+1;o=lR(n-s,c,0==s),aR(n/c)>iR-i&&cR("overflow"),i+=aR(n/c),n%=c,e.splice(n++,0,i)}var a;return String.fromCodePoint(...e)}(r):r}if(e===exports.Record.SOL)return new Wo(t).toBase58();if(e===exports.Record.ETH||e===exports.Record.BSC)return"0x"+t.toString("hex");if(e===exports.Record.Injective)return HM("inj",t,"bech32");if(e===exports.Record.A||e===exports.Record.AAAA)return nR.fromByteArray([...t]).toString();throw new Dc(exports.ErrorType.InvalidARecord)},BR=(t,e)=>{if(xR.has(e))return e!==exports.Record.CNAME&&e!==exports.Record.TXT||(t=fR(t)),Buffer.from(t,"utf-8");if(e===exports.Record.SOL)return new Wo(t).toBuffer();if(e===exports.Record.ETH||e===exports.Record.BSC)return BM("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(t.slice(2),"hex");if(e===exports.Record.Injective){const e=qM(t);return BM("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),BM(20===e.data.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(e.data)}if(e===exports.Record.A){const e=nR.parse(t).toByteArray();return BM(4===e.length,exports.ErrorType.InvalidARecord),Buffer.from(e)}if(e===exports.Record.AAAA){const e=nR.parse(t).toByteArray();return BM(16===e.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(e)}throw new Dc(exports.ErrorType.InvalidARecord)},MR=(t,e)=>{const{pubkey:r}=SM(t),n=bM("".concat(e));return vM(n,bB,r)};async function RR(t,e,r,n,i,o,s,a){const u=await Ff(e),c=await Kf(u,s,a),h=o||await t.getMinimumBalanceForRentExemption(r);let l;if(a){const{registry:e}=await Wf(t,a);l=e.owner}return Fc(kf,Os.programId,c,i,n,u,new Wc(h),new jc(r),s,a,l)}async function PR(t,e,r,n,i){const o=await Ff(e),s=await Kf(o,n,i);let a;a=n||(await oh.retrieve(t,s)).registry.owner;return qc(kf,s,r,a)}const TR=async(t,e,r,n,i)=>{let[o]=await Wo.findProgramAddress([Af.toBuffer()],Af),s=await Ff(t.toBase58()),a=await Kf(s,o,n);return[[],[new $c({name:e}).getInstruction(Af,kf,xf,a,Os.programId,o,r,ms,n,i)]]},OR=async(t,e,r,n,i,o)=>{BM(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s,hashed:a,parent:u}=SM(`${r}.${e}`,exports.RecordVersion.V1),c=_R(n,r).length,h=await t.getMinimumBalanceForRentExemption(c+oh.HEADER_LEN);return Fc(kf,Os.programId,s,i,o,a,new Wc(h),new jc(c),void 0,u,i)},LR=async(t,e,r,n,i,o)=>{const{pubkey:s,hashed:a,parent:u}=SM(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),c=ER(r,s,n,i).length,h=await t.getMinimumBalanceForRentExemption(c+oh.HEADER_LEN);return[Fc(kf,Os.programId,s,n,o,a,new Wc(h),new jc(c),void 0,u,n)]};class UR{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 Dc(exports.ErrorType.InvalidReverseTwitter);return Oe(this.schema,UR,r.data.slice(oh.HEADER_LEN))}}async function CR(t,e,r,i,o){const s=await Ff(i.toString()),a=await Kf(s,Rf,Pf);let u=He(UR.schema,new UR({twitterRegistryKey:r.toBytes(),twitterHandle:e}));return[Fc(kf,Os.programId,a,i,o,s,new Wc(await t.getMinimumBalanceForRentExemption(u.length+oh.HEADER_LEN)),new jc(u.length),Rf,Pf,Rf),Kc(kf,a,new jc(0),n.Buffer.from(u),Rf)]}UR.schema=new Map([[UR,{kind:"struct",fields:[["twitterRegistryKey",[32]],["twitterHandle","string"]]}]]);const NR=async(t,e)=>{const{pubkey:r}=SM(e),{registry:n,nftOwner:i}=await oh.retrieve(t,r);if(i)return i;try{const r=await DR(t,n.owner,e);if(void 0!==r)return r;return await zR(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},zR=async(t,e,r)=>{const i=mR(r,exports.Record.SOL),o=await bR(t,r);if(!(null==o?void 0:o.data))throw new Dc(exports.ErrorType.NoRecordData);const s=new TextEncoder,a=n.Buffer.concat([o.data.slice(0,32),i.toBuffer()]),u=s.encode(a.toString("hex"));if(!gR(u,o.data.slice(32),e))throw new Dc(exports.ErrorType.InvalidSignature);return new Wo(o.data.slice(0,32))},DR=async(t,e,r)=>{try{const n=MR(r,exports.Record.SOL),i=await kB.retrieve(t,n),o=i.getStalenessId(),s=i.getRoAId(),a=i.getContent();if(0===o.compare(e.toBuffer())&&i.header.stalenessValidation===vB.Solana&&0===s.compare(a)&&i.header.rightOfAssociationValidation===vB.Solana)return new Wo(a)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},jR=new Wo("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class WR{constructor(t){this.tag=t.tag,this.nameAccount=new Wo(t.nameAccount)}static deserialize(t){return Ze(this.schema,WR,t)}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Dc(exports.ErrorType.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(t,e){return await Wo.findProgramAddress([n.Buffer.from("favourite_domain"),e.toBuffer()],t)}static getKeySync(t,e){return Wo.findProgramAddressSync([n.Buffer.from("favourite_domain"),e.toBuffer()],t)}}WR.schema=new Map([[WR,{kind:"struct",fields:[["tag","u8"],["nameAccount",[32]]]}]]);var FR;exports.CustomBg=void 0,(FR=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",FR.Rgb0x001="rgb0x00#1";const KR=new Wo("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),VR=new Wo("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),qR={NAME_PROGRAM_ID:new Wo("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new Wo("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new Wo("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new Wo("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new Wo("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new Wo("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1")],TOKENS_SYM_MINT:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU","USDC"],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS","USDT"],["So11111111111111111111111111111111111111112","SOL"],["fidaWCioBQjieRrUQDxxS5Uxmq1CLi2VuVRyv4dEBey","FIDA"],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P","INJ"]]),PYTH_MAPPING_ACC:new Wo("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new Wo("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},HR=(t,e,r)=>{const i=[t];e?i.push(e.toBuffer()):i.push(n.Buffer.alloc(32)),r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32));const[o]=Wo.findProgramAddressSync(i,qR.NAME_PROGRAM_ID);return o},$R=(t,e=qR.ROOT_DOMAIN_ACCOUNT,r)=>{let n=bM(t);return{pubkey:HR(n,r,e),hashed:n}},GR=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}=$R(e[1]);return{...$R(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new Dc(exports.ErrorType.InvalidInput);return{...$R(t,qR.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ZR=(t,e)=>{const{pubkey:r,parent:n}=GR(t),i=bM(r.toBase58());return HR(i,qR.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function YR(t,e,r,n,i,o,s,a){const u=await Ff(e),c=await HR(u,s,a),h=o||await t.getMinimumBalanceForRentExemption(r);let l;if(a){const{registry:e}=await Wf(t,a);l=e.owner}return Fc(qR.NAME_PROGRAM_ID,Os.programId,c,i,n,u,new Wc(h),new jc(r),s,a,l)}const JR=async(t,e,r,n,i)=>{let[o]=await Wo.findProgramAddress([qR.REGISTER_PROGRAM_ID.toBuffer()],qR.REGISTER_PROGRAM_ID),s=await Ff(t.toBase58()),a=HR(s,o,n);return[[],[new $c({name:e}).getInstruction(qR.REGISTER_PROGRAM_ID,qR.NAME_PROGRAM_ID,qR.ROOT_DOMAIN_ACCOUNT,a,Os.programId,o,r,ms,n,i)]]},XR={utils:{getNameAccountKeySync:HR,reverseLookup:async(t,e)=>{const r=bM(e.toBase58()),n=HR(r,qR.REVERSE_LOOKUP_CLASS),{registry:i}=await oh.retrieve(t,n);if(!i.data)throw new Dc(exports.ErrorType.NoAccountData);const o=new re.BN(i.data.slice(0,4),"le").toNumber();return i.data.slice(4,4+o).toString()},_deriveSync:$R,getDomainKeySync:GR,getReverseKeySync:ZR},constants:qR,bindings:{createNameRegistry:YR,updateNameRegistryData:async function(t,e,r,n,i,o){const s=await Ff(e),a=HR(s,i,o);let u;return u=i||(await oh.retrieve(t,a)).registry.owner,Kc(qR.NAME_PROGRAM_ID,a,new jc(r),n,u)},transferNameOwnership:async function(t,e,r,n,i,o){const s=await Ff(e),a=HR(s,n,i);let u;return u=n||(await oh.retrieve(t,a)).registry.owner,Vc(qR.NAME_PROGRAM_ID,a,r,u,n,i,o)},deleteNameRegistry:async function(t,e,r,n,i){const o=await Ff(e),s=HR(o,n,i);let a;return a=n||(await oh.retrieve(t,s)).registry.owner,qc(qR.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(t,e,r,n,i,o=qR.USDC_MINT,s)=>{if(e.includes(".")||e.trim().toLowerCase()!==e)throw new Dc(exports.ErrorType.InvalidDomain);const[a]=Wo.findProgramAddressSync([qR.REGISTER_PROGRAM_ID.toBuffer()],qR.REGISTER_PROGRAM_ID),u=bM(e),c=HR(u,void 0,qR.ROOT_DOMAIN_ACCOUNT),h=bM(c.toBase58()),l=HR(h,a),[f]=Wo.findProgramAddressSync([c.toBuffer()],qR.REGISTER_PROGRAM_ID),d=qR.REFERRERS.findIndex((t=>null==s?void 0:s.equals(t)));let p;const y=[];if(-1!==d&&s){p=Cc(o,s,!0);const e=await t.getAccountInfo(p);if(!(null==e?void 0:e.data)){const t=Nc(n,p,s,o);y.push(t)}}const g=new Yv.PythHttpClient(t,Yv.getPythProgramKeyForCluster("devnet")),m=await g.getData(),w=qR.TOKENS_SYM_MINT.get(o.toBase58());if(!w)throw new Dc(exports.ErrorType.SymbolNotFound,`No symbol found for mint ${o.toBase58()}`);const b=m.productPrice.get("Crypto."+w+"/USD"),v=m.productFromSymbol.get("Crypto."+w+"/USD"),_=Cc(o,qR.VAULT_OWNER),E=new Gc({name:e,space:r,referrerIdxOpt:-1!=d?d:null}).getInstruction(qR.REGISTER_PROGRAM_ID,qR.NAME_PROGRAM_ID,qR.ROOT_DOMAIN_ACCOUNT,c,l,Os.programId,a,n,i,qR.PYTH_MAPPING_ACC,b.productAccountKey,new Wo(v.price_account),_,yc,ms,f,p);return y.push(E),[[],y]},createReverseName:JR,createSubdomain:async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Dc(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=GR(e),u=await t.getMinimumBalanceForRentExemption(n+oh.HEADER_LEN),c=await YR(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const h=ZR(e,!0),l=await t.getAccountInfo(h);if(!(null==l?void 0:l.data)){const[,t]=await JR(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},burnDomain:(t,e,r)=>{const{pubkey:n}=GR(t),[i]=Wo.findProgramAddressSync([n.toBuffer()],qR.REGISTER_PROGRAM_ID),[o]=Wo.findProgramAddressSync([n.toBuffer(),Uint8Array.from([1,1])],qR.REGISTER_PROGRAM_ID);return(new Yc).getInstruction(qR.REGISTER_PROGRAM_ID,qR.NAME_PROGRAM_ID,Os.programId,n,ZR(t),o,i,qR.REVERSE_LOOKUP_CLASS,e,r)},transferSubdomain:async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=GR(e);if(!a||!s)throw new Dc(exports.ErrorType.InvalidSubdomain);if(!i){const{registry:e}=await oh.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await oh.retrieve(t,a)).registry.owner);return Vc(qR.NAME_PROGRAM_ID,o,r,i,void 0,u,c)}}};exports.BONFIDA_FIDA_BNB=Bf,exports.BONFIDA_USDC_BNB=Tf,exports.CUSTOM_BG_TLD=zf,exports.ETH_ROA_RECORDS=SR,exports.FavouriteDomain=WR,exports.GUARDIANS=kR,exports.HASH_PREFIX=Sf,exports.METAPLEX_ID=jf,exports.NAME_OFFERS_ID=jR,exports.NAME_PROGRAM_ID=kf,exports.NameRegistryState=oh,exports.Numberu32=jc,exports.Numberu64=Wc,exports.PYTH_FIDA_PRICE_ACC=If,exports.PYTH_MAPPING_ACC=Cf,exports.RECORD_V1_SIZE=xB,exports.REFERRERS=Lf,exports.REGISTER_PROGRAM_ID=Af,exports.REVERSE_LOOKUP_CLASS=Mf,exports.ROOT_DOMAIN_ACCOUNT=xf,exports.ReverseTwitterRegistryState=UR,exports.SELF_SIGNED=AR,exports.SNSError=Dc,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=Uf,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=Pf,exports.TWITTER_VERIFICATION_AUTHORITY=Rf,exports.USDC_MINT=Of,exports.UTF8_ENCODED=xR,exports.VAULT_OWNER=Nf,exports.WOLVES_COLLECTION_METADATA=Df,exports.burnDomain=(t,e,r)=>{const{pubkey:n}=SM(t),[i]=Wo.findProgramAddressSync([n.toBuffer()],Af),[o]=Wo.findProgramAddressSync([n.toBuffer(),Uint8Array.from([1,1])],Af);return(new Yc).getInstruction(Af,kf,Os.programId,n,AM(t),o,i,Mf,e,r)},exports.burnInstruction=Yc,exports.changeTwitterRegistryData=async function(t,e,r,n){const i=await Ff(t),o=await Kf(i,void 0,Pf);return[Kc(kf,o,new jc(r),n,e)]},exports.changeVerifiedPubkey=async function(t,e,r,n,i){const o=await Ff(e),s=await Kf(o,void 0,Pf);let a=[Vc(kf,s,n,r,void 0)];const u=await Ff(r.toString());return await Kf(u,Rf,void 0),a.push(await PR(t,r.toString(),i,Rf,Pf)),a=a.concat(await CR(t,e,s,n,i)),a},exports.check=BM,exports.checkSolRecord=gR,exports.createInstruction=Fc,exports.createInstructionV3=Gc,exports.createNameRegistry=RR,exports.createRecordInstruction=OR,exports.createRecordV2Instruction=(t,e,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(a&&(s=SM(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,e,r,n,i,o,s,a)=>new fB({record:o,content:Array.from(s)}).getInstruction(a,sI.programId,i,t,e,r,n,bB))(i,o,s,n,kf,"".concat(e),BR(r,e),wB);return u},exports.createReverseInstruction=$c,exports.createReverseName=TR,exports.createReverseTwitterRegistry=CR,exports.createSolRecordInstruction=LR,exports.createSubdomain=async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Dc(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=SM(e),u=await t.getMinimumBalanceForRentExemption(n+oh.HEADER_LEN),c=await RR(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const h=AM(e,!0),l=await t.getAccountInfo(h);if(!(null==l?void 0:l.data)){const[,t]=await TR(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},exports.createV2Instruction=Hc,exports.createVerifiedTwitterRegistry=async function(t,e,r,n,i){const o=await Ff(e),s=await Kf(o,void 0,Pf),a=await t.getMinimumBalanceForRentExemption(n+oh.HEADER_LEN);let u=[Fc(kf,Os.programId,s,r,i,o,new Wc(a),new jc(n),void 0,Pf,Rf)];return u=u.concat(await CR(t,e,s,r,i)),u},exports.createWithNftInstruction=Zc,exports.deleteInstruction=qc,exports.deleteNameRegistry=PR,exports.deleteRecordV2=(t,e,r,n)=>{let{pubkey:i,parent:o,isSub:s}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(s&&(o=SM(t).pubkey),!o)throw new Error("Invalid parent");const a=((t,e,r,n,i,o)=>(new gB).getInstruction(o,sI.programId,i,t,n,e,r,bB))(n,o,r,i,kf,wB);return a},exports.deleteTwitterRegistry=async function(t,e){const r=await Ff(t),n=await Kf(r,void 0,Pf),i=await Ff(e.toString()),o=await Kf(i,Rf,Pf);return[qc(kf,n,e,e),qc(kf,o,e,e)]},exports.deserializeRecord=vR,exports.deserializeRecordV2Content=IR,exports.deserializeReverse=MM,exports.devnet=XR,exports.ethValidateRecordV2Content=(t,e,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(u&&(a=SM(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,e,r,n,i,o,s,a,u)=>new dB({validation:o,signature:Array.from(s),expectedPubkey:Array.from(a)}).getInstruction(u,sI.programId,i,t,e,r,n,bB))(n,s,a,r,kf,vB.Ethereum,i,o,wB);return c},exports.findSubdomains=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Mf.toBase58()}}],n=await t.getProgramAccounts(kf,{filters:r}),i=await _M(t,e),o=n.map((t=>{var e;return null===(e=t.account.data.slice(97).toString("utf-8"))||void 0===e?void 0:e.split("\0").join("")})),s=o.map((t=>SM(t+"."+i).pubkey)),a=await t.getMultipleAccountsInfo(s);return o.filter(((t,e)=>!!a[e]))},exports.getAllDomains=xM,exports.getAllRegisteredDomains=async t=>{const e=[{memcmp:{offset:0,bytes:xf.toBase58()}}];return await t.getProgramAccounts(kf,{dataSlice:{offset:32,length:32},filters:e})},exports.getArtistPubkey=t=>{switch(t){case exports.CustomBg.DegenPoet1:return KR;case exports.CustomBg.Rgb0x001:return VR;default:throw new Dc(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(t,e)=>await wR(t,e,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(t,e)=>await wR(t,e,exports.Record.Background,!0),exports.getBackpackRecord=async(t,e)=>await wR(t,e,exports.Record.Backpack,!0),exports.getBscRecord=async(t,e)=>await wR(t,e,exports.Record.BSC,!0),exports.getBtcRecord=async(t,e)=>await wR(t,e,exports.Record.BTC,!0),exports.getCustomBgKeys=(t,e)=>{const r=bM(e),n=bM(t),i=vM(n,void 0,zf);return{domainKey:i,bgKey:vM(r,void 0,i)}},exports.getDiscordRecord=async(t,e)=>await wR(t,e,exports.Record.Discord,!0),exports.getDogeRecord=async(t,e)=>await wR(t,e,exports.Record.DOGE,!0),exports.getDomainKey=qf,exports.getDomainKeySync=SM,exports.getDomainKeysWithReverses=async function(t,e){const r=await xM(t,e),n=await EM(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))},exports.getDomainPriceFromName=t=>{switch(wM(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}},exports.getEmailRecord=async(t,e)=>await wR(t,e,exports.Record.Email,!0),exports.getEthRecord=async(t,e)=>await wR(t,e,exports.Record.ETH,!0),exports.getFavoriteDomain=async(t,e)=>{const[r]=WR.getKeySync(jR,new Wo(e)),n=await WR.retrieve(t,r),i=await _M(t,n.nameAccount),o=await NR(t,i);return{domain:n.nameAccount,reverse:i,stale:!e.equals(o)}},exports.getGithubRecord=async(t,e)=>await wR(t,e,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(t,e){const r=await Ff(e.toString()),n=await Kf(r,Rf,Pf);let i=await UR.retrieve(t,n);return[i.twitterHandle,new Wo(i.twitterRegistryKey)]},exports.getHashedName=Ff,exports.getHashedNameSync=bM,exports.getInjectiveRecord=async(t,e)=>await wR(t,e,exports.Record.Injective,!0),exports.getIpfsRecord=async(t,e)=>await wR(t,e,exports.Record.IPFS,!0),exports.getLtcRecord=async(t,e)=>await wR(t,e,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(t,e)=>{const r=[],n=e.map((t=>WR.getKeySync(jR,t)[0])),i=(await t.getMultipleAccountsInfo(n)).map((t=>(null==t?void 0:t.data)?WR.deserialize(null==t?void 0:t.data).nameAccount:Wo.default)),o=i.map((t=>IM(t))),s=i.map(((t,r)=>Cc((t=>{const[e]=Wo.findProgramAddressSync([Xc,t.toBuffer()],Jc);return e})(t),e[r],!0))),[a,u,c]=await Promise.all([t.getMultipleAccountsInfo(i),t.getMultipleAccountsInfo(o),t.getMultipleAccountsInfo(s)]);for(let t=0;t<e.length;t++){const n=a[t],i=u[t],o=c[t];if(!n||!i){r.push(void 0);continue}if(new Wo(null==n?void 0:n.data.slice(32,64)).equals(e[t])){r.push(MM(null==i?void 0:i.data.slice(96)));continue}if(!o){r.push(void 0);continue}const s=Pc.decode(o.data);1!==Number(s.amount)?r.push(void 0):r.push(MM(null==i?void 0:i.data.slice(96)))}return r},exports.getMultipleRecordsV2=async function(t,e,r,n={}){const i=r.map((t=>MR(e,t))),o=await kB.retrieveBatch(t,i);return n.deserialize?o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:IR(t.getContent(),r[e])}})):o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))},exports.getNameAccountKey=Kf,exports.getNameAccountKeySync=vM,exports.getNameOwner=Wf,exports.getPicRecord=async(t,e)=>await wR(t,e,exports.Record.Pic,!0),exports.getPointRecord=async(t,e)=>await wR(t,e,exports.Record.POINT,!0),exports.getRecord=wR,exports.getRecordKeySync=mR,exports.getRecordV2=async function(t,e,r,n={}){const i=MR(e,r),o=await kB.retrieve(t,i);return n.deserialize?{retrievedRecord:o,deserializedContent:IR(o.getContent(),r)}:{retrievedRecord:o}},exports.getRecordV2Key=MR,exports.getRecords=async function(t,e,r,n){const i=r.map((t=>mR(e,t))),o=await oh.retrieveBatch(t,i);return n?o.map(((t,n)=>{if(t)return vR(t,r[n],mR(e,r[n]))})):o},exports.getRedditRecord=async(t,e)=>await wR(t,e,exports.Record.Reddit,!0),exports.getReverseKey=async(t,e)=>{const{pubkey:r,parent:n}=await qf(t),i=await Ff(r.toBase58());return await Kf(i,Mf,e?n:void 0)},exports.getReverseKeyFromDomainKey=IM,exports.getReverseKeySync=AM,exports.getShdwRecord=async(t,e)=>await wR(t,e,exports.Record.SHDW,!0),exports.getSolRecord=bR,exports.getTelegramRecord=async(t,e)=>await wR(t,e,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(t,e)=>{const r=await ih(t,e),n=await EM(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))},exports.getTwitterHandleandRegistryKeyViaFilters=async function(t,e){const r=[{memcmp:{offset:0,bytes:Pf.toBase58()}},{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Rf.toBase58()}}],n=await t.getProgramAccounts(kf,{filters:r});for(const t of n)if(t.account.data.length>oh.HEADER_LEN+32){let e=t.account.data.slice(oh.HEADER_LEN),r=Oe(UR.schema,UR,e);return[r.twitterHandle,new Wo(r.twitterRegistryKey)]}throw new Dc(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(t,e)=>await wR(t,e,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(t,e){const r=await Ff(e),n=await Kf(r,void 0,Pf),{registry:i}=await oh.retrieve(t,n);return i},exports.getTwitterRegistryData=async function(t,e){const r=[{memcmp:{offset:0,bytes:Pf.toBase58()}},{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:new Wo(n.Buffer.alloc(32,0)).toBase58()}}],i=await t.getProgramAccounts(kf,{filters:r});if(i.length>1)throw new Dc(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(oh.HEADER_LEN)},exports.getTwitterRegistryKey=async function(t){const e=await Ff(t);return await Kf(e,void 0,Pf)},exports.getUrlRecord=async(t,e)=>await wR(t,e,exports.Record.Url,!0),exports.performReverseLookup=async function(t,e){const r=await Ff(e.toBase58()),n=await Kf(r,Mf),{registry:i}=await oh.retrieve(t,n);if(!i.data)throw new Dc(exports.ErrorType.NoAccountData);const o=new ne(i.data.slice(0,4),"le").toNumber();return i.data.slice(4,4+o).toString()},exports.performReverseLookupBatch=async function(t,e){let r=[];for(let t of e){const e=await Ff(t.toBase58()),n=await Kf(e,Mf);r.push(n)}return(await oh.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;let e=new ne(t.data.slice(0,4),"le").toNumber();return t.data.slice(4,4+e).toString()}))},exports.reallocInstruction=function(t,e,r,i,o,s){const a=[n.Buffer.from(Int8Array.from([4])),s.toBuffer()],u=n.Buffer.concat(a);return new cs({keys:[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:u})},exports.registerDomainName=async(t,e,r,n,i,o=Of,s)=>{if(e.includes(".")||e.trim().toLowerCase()!==e)throw new Dc(exports.ErrorType.InvalidDomain);const[a]=Wo.findProgramAddressSync([Af.toBuffer()],Af),u=bM(e),c=vM(u,void 0,xf),h=bM(c.toBase58()),l=vM(h,a),[f]=Wo.findProgramAddressSync([c.toBuffer()],Af),d=Lf.findIndex((t=>null==s?void 0:s.equals(t)));let p;const y=[];if(-1!==d&&s){p=Cc(o,s,!0);const e=await t.getAccountInfo(p);if(!(null==e?void 0:e.data)){const t=Nc(n,p,s,o);y.push(t)}}const g=new Yv.PythHttpClient(t,Yv.getPythProgramKeyForCluster("mainnet-beta")),m=await g.getData(),w=Uf.get(o.toBase58());if(!w)throw new Dc(exports.ErrorType.SymbolNotFound,`No symbol found for mint ${o.toBase58()}`);const b=m.productPrice.get("Crypto."+w+"/USD"),v=m.productFromSymbol.get("Crypto."+w+"/USD"),_=Cc(o,Nf),E=new Gc({name:e,space:r,referrerIdxOpt:-1!=d?d:null}).getInstruction(Af,kf,xf,c,l,Os.programId,a,n,i,Cf,b.productAccountKey,new Wo(v.price_account),_,yc,ms,f,p);return y.push(E),[[],y]},exports.registerWithNft=(t,e,r,n,i,o,s,a,u)=>{const[c]=Wo.findProgramAddressSync([r.toBuffer()],Af);return new Zc({space:e,name:t}).getInstruction(Af,kf,xf,r,n,Os.programId,Mf,i,o,s,a,u,Df,yc,ms,c,jf)},exports.resolve=NR,exports.retrieveNftOwner=eh,exports.retrieveNfts=async t=>{const e=await t.getProgramAccounts(Jc,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return e.map((t=>new Wo(t.account.data.slice(66,98))))},exports.retrieveRecords=ih,exports.reverseLookup=_M,exports.reverseLookupBatch=EM,exports.serializeRecord=_R,exports.serializeRecordV2Content=BR,exports.serializeSolRecord=ER,exports.transferInstruction=Vc,exports.transferNameOwnership=async function(t,e,r,n,i,o){const s=await Ff(e),a=await Kf(s,n,i);let u;return u=n||(await oh.retrieve(t,a)).registry.owner,Vc(kf,a,r,u,n,i,o)},exports.transferSubdomain=async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=SM(e);if(!a||!s)throw new Dc(exports.ErrorType.InvalidSubdomain);if(!i){const{registry:e}=await oh.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await oh.retrieve(t,a)).registry.owner);return Vc(kf,o,r,i,void 0,u,c)},exports.updateInstruction=Kc,exports.updateNameRegistryData=async function(t,e,r,n,i,o){const s=await Ff(e),a=await Kf(s,i,o);let u;return u=i||(await oh.retrieve(t,a)).registry.owner,Kc(kf,a,new jc(r),n,u)},exports.updateRecordInstruction=async(t,e,r,n,i,o)=>{BM(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=SM(`${r}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);BM(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const u=_R(n,r);if((null==a?void 0:a.data.slice(96).length)!==u.length)return[qc(kf,s,o,i),await OR(t,e,r,n,i,o)];return[Kc(kf,s,new jc(0),u,i)]},exports.updateRecordV2Instruction=(t,e,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(a&&(s=SM(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,e,r,n,i,o,s,a)=>new yB({record:o,content:Array.from(s)}).getInstruction(a,sI.programId,i,t,e,r,n,bB))(i,o,s,n,kf,"".concat(e),BR(r,e),wB);return u},exports.updateSolRecordInstruction=async(t,e,r,n,i,o)=>{const{pubkey:s}=SM(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);if(BM(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[qc(kf,s,o,n),await LR(t,e,r,n,i,o)];const u=ER(r,s,n,i);return[Kc(kf,s,new jc(0),u,n)]},exports.validateRecordV2Content=(t,e,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=SM(`${r}.${e}`,exports.RecordVersion.V2);if(u&&(a=SM(e).pubkey),!a)throw new Error("Invalid parent");const c=((t,e,r,n,i,o,s,a)=>new pB({staleness:s}).getInstruction(a,sI.programId,o,t,e,r,n,bB,i))(i,s,a,n,o,kf,t,wB);return c},exports.verifyRightOfAssociation=async(t,e,r,n)=>{var i;const o=MR(r,e),s=await kB.retrieve(t,o),a=s.getRoAId(),u=SR.has(e)?vB.Ethereum:vB.Solana;if(!(n=null!=n?n:null===(i=kR.get(e))||void 0===i?void 0:i.toBuffer()))throw new Dc(exports.ErrorType.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===u},exports.verifyStaleness=async(t,e,r)=>{const n=MR(r,e),i=await NR(t,r),o=await kB.retrieve(t,n),s=o.getStalenessId();return i.equals(new Wo(s))&&o.header.stalenessValidation===vB.Solana},exports.writRoaRecordV2=(t,e,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(a&&(s=SM(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,e,r,n,i,o,s)=>new mB({roaId:Array.from(o.toBuffer())}).getInstruction(s,sI.programId,e,t,r,n,i,bB))(n,kf,o,s,r,i,wB);return u};
44
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const SA=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),xA=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),AA=BigInt(1),IA=BigInt(2),BA=(t,e)=>(t+e/IA)/e,MA=pE(SA,void 0,void 0,{sqrt:function(t){const e=SA,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,h=c*c*t%e,l=hE(h,r,e)*h%e,f=hE(l,r,e)*h%e,d=hE(f,IA,e)*c%e,p=hE(d,i,e)*d%e,y=hE(p,o,e)*p%e,g=hE(y,a,e)*y%e,m=hE(g,u,e)*g%e,w=hE(m,a,e)*y%e,b=hE(w,r,e)*h%e,v=hE(b,s,e)*p%e,_=hE(v,n,e)*c%e,E=hE(_,IA,e);if(!MA.eql(MA.sqr(E),t))throw new Error("Cannot find square root");return E}}),RA=function(t,e){const r=e=>vA({...t,...kA(e)});return Object.freeze({...r(e),create:r})}({a:BigInt(0),b:BigInt(7),Fp:MA,n:xA,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=xA,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-AA*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=BA(o*t,e),u=BA(-n*t,e);let c=uE(t-a*r-u*i,e),h=uE(-a*n-u*o,e);const l=c>s,f=h>s;if(l&&(c=e-c),f&&(h=e-h),c>s||h>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:f,k2:h}}}},XE);function PA(t){try{return NE.ExtendedPoint.fromHex(t),!0}catch{return!1}}BigInt(0),RA.ProjectivePoint;const TA=NE.verify,OA=t=>t_.Buffer.isBuffer(t)?t:t instanceof Uint8Array?t_.Buffer.from(t.buffer,t.byteOffset,t.byteLength):t_.Buffer.from(t);class LA{constructor(t){Object.assign(this,t)}encode(){return t_.Buffer.from(Mk(UA,this))}static decode(t){return Tk(UA,this,t)}static decodeUnchecked(t){return gk(UA,this,t)}}const UA=new Map;var CA;let NA;const zA=32;let DA=1;NA=Symbol.toStringTag;class jA extends LA{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=HE.decode(t);if(e.length!=zA)throw new Error("Invalid public key input");this._bn=new FE(e)}else this._bn=new FE(t);if(this._bn.byteLength()>zA)throw new Error("Invalid public key input")}}static unique(){const t=new jA(DA);return DA+=1,new jA(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return HE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(t_.Buffer);if(t.length===zA)return t;const e=t_.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[NA](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){const n=t_.Buffer.concat([t.toBuffer(),t_.Buffer.from(e),r.toBuffer()]),i=XE(n);return new jA(i)}static createProgramAddressSync(t,e){let r=t_.Buffer.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");r=t_.Buffer.concat([r,OA(t)])})),r=t_.Buffer.concat([r,e.toBuffer(),t_.Buffer.from("ProgramDerivedAddress")]);const n=XE(r);if(PA(n))throw new Error("Invalid seeds, address must fall off the curve");return new jA(n)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r,n=255;for(;0!=n;){try{const i=t.concat(t_.Buffer.from([n]));r=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;n--;continue}return[r,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return PA(new jA(t).toBytes())}}CA=jA,jA.default=new CA("11111111111111111111111111111111"),UA.set(jA,{kind:"struct",fields:[["_bn","u256"]]}),new jA("BPFLoader1111111111111111111111111111111111");class WA{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t<e.length)return e[t];t-=e.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach(((t,r)=>{e.set(t.toBase58(),r)}));const r=t=>{const r=e.get(t.toBase58());if(void 0===r)throw new Error("Encountered an unknown instruction account key during compilation");return r};return t.map((t=>({programIdIndex:r(t.programId),accountKeyIndexes:t.keys.map((t=>r(t.pubkey))),data:t.data})))}}const FA=(t="publicKey")=>xS(32,t),KA=(t="string")=>{const e=kS([vS("length"),vS("lengthPadding"),xS(mS(vS(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(t,e)=>r(t,e).chars.toString(),i.encode=(t,e,r)=>{const i={chars:t_.Buffer.from(t,"utf8")};return n(i,e,r)},i.alloc=t=>vS().span+vS().span+t_.Buffer.from(t,"utf8").length,i};function VA(t,e){const r=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(e[t.property]);if("count"in t&&"elementLayout"in t){const n=e[t.property];if(Array.isArray(n))return n.length*r(t.elementLayout)}else if("fields"in t)return VA({layout:t},e[t.property]);return 0};let n=0;return t.layout.fields.forEach((t=>{n+=r(t)})),n}function qA(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(127&n)<<7*r,r+=1,0==(128&n))break}return e}function HA(t,e){let r=e;for(;;){let e=127&r;if(r>>=7,0==r){t.push(e);break}e|=128,t.push(e)}}function $A(t,e){if(!t)throw new Error(e||"Assertion failed")}class GA{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const r=new Map,n=t=>{const e=t.toBase58();let n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},i=n(e);i.isSigner=!0,i.isWritable=!0;for(const e of t){n(e.programId).isInvoked=!0;for(const t of e.keys){const e=n(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}}return new GA(e,r)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];$A(t.length<=256,"Max static account keys length exceeded");const e=t.filter((([,t])=>t.isSigner&&t.isWritable)),r=t.filter((([,t])=>t.isSigner&&!t.isWritable)),n=t.filter((([,t])=>!t.isSigner&&t.isWritable)),i=t.filter((([,t])=>!t.isSigner&&!t.isWritable)),o={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{$A(e.length>0,"Expected at least one writable signer key");const[t]=e[0];$A(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map((([t])=>new jA(t))),...r.map((([t])=>new jA(t))),...n.map((([t])=>new jA(t))),...i.map((([t])=>new jA(t)))]]}extractTableLookup(t){const[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&t.isWritable)),[n,i]=this.drainKeysFoundInLookupTable(t.state.addresses,(t=>!t.isSigner&&!t.isInvoked&&!t.isWritable));if(0!==e.length||0!==n.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(t,e){const r=new Array,n=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const e=new jA(i),o=t.findIndex((t=>t.equals(e)));o>=0&&($A(o<256,"Max lookup table index exceeded"),r.push(o),n.push(e),this.keyMetaMap.delete(i))}return[r,n]}}class ZA{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new jA(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:HE.decode(t.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new WA(this.staticAccountKeys)}static compile(t){const e=GA.compile(t.instructions,t.payerKey),[r,n]=e.getMessageComponents(),i=new WA(n).compileInstructions(t.instructions).map((t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:HE.encode(t.data)})));return new ZA({header:r,accountKeys:n,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const e=this.header.numRequiredSignatures;return t>=this.header.numRequiredSignatures?t-e<this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts:t<e-this.header.numReadonlySignedAccounts}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((t,e)=>!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];HA(e,t);const r=this.instructions.map((t=>{const{accounts:e,programIdIndex:r}=t,n=Array.from(HE.decode(t.data));let i=[];HA(i,e.length);let o=[];return HA(o,n.length),{programIdIndex:r,keyIndicesCount:t_.Buffer.from(i),keyIndices:e,dataLength:t_.Buffer.from(o),data:n}}));let n=[];HA(n,r.length);let i=t_.Buffer.alloc(1232);t_.Buffer.from(n).copy(i);let o=n.length;r.forEach((t=>{const e=kS([wS("programIdIndex"),xS(t.keyIndicesCount.length,"keyIndicesCount"),SS(wS("keyIndex"),t.keyIndices.length,"keyIndices"),xS(t.dataLength.length,"dataLength"),SS(wS("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const s=kS([xS(1,"numRequiredSignatures"),xS(1,"numReadonlySignedAccounts"),xS(1,"numReadonlyUnsignedAccounts"),xS(e.length,"keyCount"),SS(FA("key"),t,"keys"),FA("recentBlockhash")]),a={numRequiredSignatures:t_.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:t_.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:t_.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:t_.Buffer.from(e),keys:this.accountKeys.map((t=>OA(t.toBytes()))),recentBlockhash:HE.decode(this.recentBlockhash)};let u=t_.Buffer.alloc(2048);const c=s.encode(a,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(t){let e=[...t];const r=e.shift();if(r!==(127&r))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const n=e.shift(),i=e.shift(),o=qA(e);let s=[];for(let t=0;t<o;t++){const t=e.slice(0,zA);e=e.slice(zA),s.push(new jA(t_.Buffer.from(t)))}const a=e.slice(0,zA);e=e.slice(zA);const u=qA(e);let c=[];for(let t=0;t<u;t++){const t=e.shift(),r=qA(e),n=e.slice(0,r);e=e.slice(r);const i=qA(e),o=e.slice(0,i),s=HE.encode(t_.Buffer.from(o));e=e.slice(i),c.push({programIdIndex:t,accounts:n,data:s})}const h={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:i},recentBlockhash:HE.encode(t_.Buffer.from(a)),accountKeys:s,instructions:c};return new ZA(h)}}const YA=t_.Buffer.alloc(64).fill(0);class JA{constructor(t){this.keys=void 0,this.programId=void 0,this.data=t_.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:r})=>({pubkey:t.toJSON(),isSigner:e,isWritable:r}))),programId:this.programId.toJSON(),data:[...this.data]}}}class XA{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:r}=t;this.minNonceContextSlot=e,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:r}=t;this.recentBlockhash=e,this.lastValidBlockHeight=r}else{const{recentBlockhash:e,nonceInfo:r}=t;r&&(this.nonceInfo=r),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new JA(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,r;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)r=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");r=this.signatures[0].publicKey}for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw new Error(`Transaction instruction index ${t} has undefined program id`);const n=[],i=[];e.forEach((t=>{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();n.includes(e)||n.push(e)})),n.forEach((t=>{i.push({pubkey:new jA(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),r=o.findIndex((t=>t.pubkey.toString()===e));r>-1?(o[r].isWritable=o[r].isWritable||t.isWritable,o[r].isSigner=o[r].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((t=>t.pubkey.equals(r)));if(s>-1){const[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const h=[],l=[];o.forEach((({pubkey:t,isSigner:e,isWritable:r})=>{e?(h.push(t.toString()),a+=1,r||(u+=1)):(l.push(t.toString()),r||(c+=1))}));const f=h.concat(l),d=e.map((t=>{const{data:e,programId:r}=t;return{programIdIndex:f.indexOf(r.toString()),accounts:t.keys.map((t=>f.indexOf(t.pubkey.toString()))),data:HE.encode(e)}}));return d.forEach((t=>{$A(t.programIdIndex>=0),t.accounts.forEach((t=>$A(t>=0)))})),new ZA({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:f,recentBlockhash:t,instructions:d})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every(((t,r)=>e[r].equals(t.publicKey)))||(this.signatures=e.map((t=>({signature:null,publicKey:t})))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const r=t.toString();return!e.has(r)&&(e.add(r),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,r=[];for(const n of t){const t=n.publicKey.toString();e.has(t)||(e.add(t),r.push(n))}this.signatures=r.map((t=>({signature:null,publicKey:t.publicKey})));const n=this._compile();this._partialSign(n,...r)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,r=[];for(const n of t){const t=n.publicKey.toString();e.has(t)||(e.add(t),r.push(n))}const n=this._compile();this._partialSign(n,...r)}_partialSign(t,...e){const r=t.serialize();e.forEach((t=>{const e=((t,e)=>NE.sign(t,e.slice(0,32)))(r,t.secretKey);this._addSignature(t.publicKey,OA(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){$A(64===e.length);const r=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(r<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=t_.Buffer.from(e)}verifySignatures(t){return this._verifySignatures(this.serializeMessage(),void 0===t||t)}_verifySignatures(t,e){for(const{signature:r,publicKey:n}of this.signatures)if(null===r){if(e)return!1}else if(!TA(r,t,n.toBytes()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),n=this.serializeMessage();if(r&&!this._verifySignatures(n,e))throw new Error("Signature verification failed");return this._serialize(n)}_serialize(t){const{signatures:e}=this,r=[];HA(r,e.length);const n=r.length+64*e.length+t.length,i=t_.Buffer.alloc(n);return $A(e.length<256),t_.Buffer.from(r).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&($A(64===t.length,"signature has invalid length"),t_.Buffer.from(t).copy(i,r.length+64*e))})),t.copy(i,r.length+64*e.length),$A(i.length<=1232,`Transaction too large: ${i.length} > 1232`),i}get keys(){return $A(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return $A(1===this.instructions.length),this.instructions[0].programId}get data(){return $A(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const r=qA(e);let n=[];for(let t=0;t<r;t++){const t=e.slice(0,64);e=e.slice(64),n.push(HE.encode(t_.Buffer.from(t)))}return XA.populate(ZA.from(e),n)}static populate(t,e=[]){const r=new XA;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach(((e,n)=>{const i={signature:e==HE.encode(YA)?null:HE.decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)})),t.instructions.forEach((e=>{const n=e.accounts.map((e=>{const n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some((t=>t.publicKey.toString()===n.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));r.instructions.push(new JA({keys:n,programId:t.accountKeys[e.programIdIndex],data:HE.decode(e.data)}))})),r._message=t,r._json=r.toJSON(),r}}new jA("SysvarC1ock11111111111111111111111111111111"),new jA("SysvarEpochSchedu1e111111111111111111111111"),new jA("Sysvar1nstructions1111111111111111111111111");const QA=new jA("SysvarRecentB1ockHashes11111111111111111111"),tI=new jA("SysvarRent111111111111111111111111111111111");function eI(t,e){const r=t.layout.span>=0?t.layout.span:VA(t,e),n=t_.Buffer.alloc(r),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,n),n}new jA("SysvarRewards111111111111111111111111111111"),new jA("SysvarS1otHashes111111111111111111111111111"),new jA("SysvarS1otHistory11111111111111111111111111"),new jA("SysvarStakeHistory1111111111111111111111111");const rI=_S("lamportsPerSignature"),nI=kS([vS("version"),vS("state"),FA("authorizedPubkey"),FA("nonce"),kS([rI],"feeCalculator")]).span,iI=(8,t=>{const e=xS(8,t),{encode:r,decode:n}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const r=n(t,e);return IS(t_.Buffer.from(r))},i.encode=(t,e,n)=>{const i=MS(t,8);return r(i,e,n)},i});const oI=Object.freeze({Create:{index:0,layout:kS([vS("instruction"),ES("lamports"),ES("space"),FA("programId")])},Assign:{index:1,layout:kS([vS("instruction"),FA("programId")])},Transfer:{index:2,layout:kS([vS("instruction"),iI("lamports")])},CreateWithSeed:{index:3,layout:kS([vS("instruction"),FA("base"),KA("seed"),ES("lamports"),ES("space"),FA("programId")])},AdvanceNonceAccount:{index:4,layout:kS([vS("instruction")])},WithdrawNonceAccount:{index:5,layout:kS([vS("instruction"),ES("lamports")])},InitializeNonceAccount:{index:6,layout:kS([vS("instruction"),FA("authorized")])},AuthorizeNonceAccount:{index:7,layout:kS([vS("instruction"),FA("authorized")])},Allocate:{index:8,layout:kS([vS("instruction"),ES("space")])},AllocateWithSeed:{index:9,layout:kS([vS("instruction"),FA("base"),KA("seed"),ES("space"),FA("programId")])},AssignWithSeed:{index:10,layout:kS([vS("instruction"),FA("base"),KA("seed"),FA("programId")])},TransferWithSeed:{index:11,layout:kS([vS("instruction"),iI("lamports"),KA("seed"),FA("programId")])},UpgradeNonceAccount:{index:12,layout:kS([vS("instruction")])}});class sI{constructor(){}static createAccount(t){const e=eI(oI.Create,{lamports:t.lamports,space:t.space,programId:OA(t.programId.toBuffer())});return new JA({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,r;return"basePubkey"in t?(e=eI(oI.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=eI(oI.Transfer,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new JA({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;return"basePubkey"in t?(e=eI(oI.AssignWithSeed,{base:OA(t.basePubkey.toBuffer()),seed:t.seed,programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=eI(oI.Assign,{programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new JA({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=eI(oI.CreateWithSeed,{base:OA(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:OA(t.programId.toBuffer())});let r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&r.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new JA({keys:r,programId:this.programId,data:e})}static createNonceAccount(t){const e=new XA;"basePubkey"in t&&"seed"in t?e.add(sI.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:nI,programId:this.programId})):e.add(sI.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:nI,programId:this.programId}));const r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){const e=eI(oI.InitializeNonceAccount,{authorized:OA(t.authorizedPubkey.toBuffer())}),r={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:QA,isSigner:!1,isWritable:!1},{pubkey:tI,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new JA(r)}static nonceAdvance(t){const e=eI(oI.AdvanceNonceAccount),r={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:QA,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new JA(r)}static nonceWithdraw(t){const e=eI(oI.WithdrawNonceAccount,{lamports:t.lamports});return new JA({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:QA,isSigner:!1,isWritable:!1},{pubkey:tI,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=eI(oI.AuthorizeNonceAccount,{authorized:OA(t.newAuthorizedPubkey.toBuffer())});return new JA({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,r;return"basePubkey"in t?(e=eI(oI.AllocateWithSeed,{base:OA(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:OA(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=eI(oI.Allocate,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new JA({keys:r,programId:this.programId,data:e})}}sI.programId=new jA("11111111111111111111111111111111"),new jA("BPFLoader2111111111111111111111111111111111"),kS([vS("typeIndex"),iI("deactivationSlot"),_S("lastExtendedSlot"),wS("lastExtendedStartIndex"),wS(),SS(FA(),mS(wS(),-1),"authority")]);const aI=tx(KS(jA),ZS(),(t=>new jA(t))),uI=YS([ZS(),VS("base64")]),cI=tx(KS(t_.Buffer),uI,(t=>t_.Buffer.from(t[0],"base64")));function hI(t){return XS([JS({jsonrpc:VS("2.0"),id:ZS(),result:t}),JS({jsonrpc:VS("2.0"),id:ZS(),error:JS({code:QS(),message:ZS(),data:$S(jS("any",(()=>!0)))})})])}const lI=hI(QS());function fI(t){return tx(hI(t),lI,(e=>"error"in e?e:{...e,result:NS(e.result,t)}))}function dI(t){return fI(JS({context:JS({slot:HS()}),value:t}))}function pI(t){return JS({context:JS({slot:HS()}),value:t})}const yI=JS({foundation:HS(),foundationTerm:HS(),initial:HS(),taper:HS(),terminal:HS()});fI(WS(qS(JS({epoch:HS(),effectiveSlot:HS(),amount:HS(),postBalance:HS(),commission:$S(qS(HS()))}))));const gI=WS(JS({slot:HS(),prioritizationFee:HS()})),mI=JS({total:HS(),validator:HS(),foundation:HS(),epoch:HS()}),wI=JS({epoch:HS(),slotIndex:HS(),slotsInEpoch:HS(),absoluteSlot:HS(),blockHeight:$S(HS()),transactionCount:$S(HS())}),bI=JS({slotsPerEpoch:HS(),leaderScheduleSlotOffset:HS(),warmup:FS(),firstNormalEpoch:HS(),firstNormalSlot:HS()}),vI=GS(ZS(),WS(HS())),_I=qS(XS([JS({}),ZS()])),EI=JS({err:_I}),kI=VS("receivedSignature");JS({"solana-core":ZS(),"feature-set":$S(HS())}),dI(JS({err:qS(XS([JS({}),ZS()])),logs:qS(WS(ZS())),accounts:$S(qS(WS(qS(JS({executable:FS(),owner:ZS(),lamports:HS(),data:WS(ZS()),rentEpoch:$S(HS())}))))),unitsConsumed:$S(HS()),returnData:$S(qS(JS({programId:ZS(),data:YS([ZS(),VS("base64")])})))})),dI(JS({byIdentity:GS(ZS(),WS(HS())),range:JS({firstSlot:HS(),lastSlot:HS()})})),fI(yI),fI(mI),fI(gI),fI(wI),fI(bI),fI(vI),fI(HS()),dI(JS({total:HS(),circulating:HS(),nonCirculating:HS(),nonCirculatingAccounts:WS(aI)}));const SI=JS({amount:ZS(),uiAmount:qS(HS()),decimals:HS(),uiAmountString:$S(ZS())});dI(WS(JS({address:aI,amount:ZS(),uiAmount:qS(HS()),decimals:HS(),uiAmountString:$S(ZS())}))),dI(WS(JS({pubkey:aI,account:JS({executable:FS(),owner:aI,lamports:HS(),data:cI,rentEpoch:HS()})})));const xI=JS({program:ZS(),parsed:QS(),space:HS()});dI(WS(JS({pubkey:aI,account:JS({executable:FS(),owner:aI,lamports:HS(),data:xI,rentEpoch:HS()})}))),dI(WS(JS({lamports:HS(),address:aI})));const AI=JS({executable:FS(),owner:aI,lamports:HS(),data:cI,rentEpoch:HS()});JS({pubkey:aI,account:AI});const II=tx(XS([KS(t_.Buffer),xI]),XS([uI,xI]),(t=>Array.isArray(t)?NS(t,cI):t)),BI=JS({executable:FS(),owner:aI,lamports:HS(),data:II,rentEpoch:HS()});JS({pubkey:aI,account:BI}),JS({state:XS([VS("active"),VS("inactive"),VS("activating"),VS("deactivating")]),active:HS(),inactive:HS()}),fI(WS(JS({signature:ZS(),slot:HS(),err:_I,memo:qS(ZS()),blockTime:$S(qS(HS()))}))),fI(WS(JS({signature:ZS(),slot:HS(),err:_I,memo:qS(ZS()),blockTime:$S(qS(HS()))}))),JS({subscription:HS(),result:pI(AI)});const MI=JS({pubkey:aI,account:AI});JS({subscription:HS(),result:pI(MI)});const RI=JS({parent:HS(),slot:HS(),root:HS()});JS({subscription:HS(),result:RI});const PI=XS([JS({type:XS([VS("firstShredReceived"),VS("completed"),VS("optimisticConfirmation"),VS("root")]),slot:HS(),timestamp:HS()}),JS({type:VS("createdBank"),parent:HS(),slot:HS(),timestamp:HS()}),JS({type:VS("frozen"),slot:HS(),timestamp:HS(),stats:JS({numTransactionEntries:HS(),numSuccessfulTransactions:HS(),numFailedTransactions:HS(),maxTransactionsPerEntry:HS()})}),JS({type:VS("dead"),slot:HS(),timestamp:HS(),err:ZS()})]);JS({subscription:HS(),result:PI}),JS({subscription:HS(),result:pI(XS([EI,kI]))}),JS({subscription:HS(),result:HS()}),JS({pubkey:ZS(),gossip:qS(ZS()),tpu:qS(ZS()),rpc:qS(ZS()),version:qS(ZS())});const TI=JS({votePubkey:ZS(),nodePubkey:ZS(),activatedStake:HS(),epochVoteAccount:FS(),epochCredits:WS(YS([HS(),HS(),HS()])),commission:HS(),lastVote:HS(),rootSlot:qS(HS())});fI(JS({current:WS(TI),delinquent:WS(TI)}));const OI=XS([VS("processed"),VS("confirmed"),VS("finalized")]),LI=JS({slot:HS(),confirmations:qS(HS()),err:_I,confirmationStatus:$S(OI)});dI(WS(qS(LI))),fI(HS());const UI=JS({accountKey:aI,writableIndexes:WS(HS()),readonlyIndexes:WS(HS())}),CI=JS({signatures:WS(ZS()),message:JS({accountKeys:WS(ZS()),header:JS({numRequiredSignatures:HS(),numReadonlySignedAccounts:HS(),numReadonlyUnsignedAccounts:HS()}),instructions:WS(JS({accounts:WS(HS()),data:ZS(),programIdIndex:HS()})),recentBlockhash:ZS(),addressTableLookups:$S(WS(UI))})}),NI=JS({pubkey:aI,signer:FS(),writable:FS(),source:$S(XS([VS("transaction"),VS("lookupTable")]))}),zI=JS({accountKeys:WS(NI),signatures:WS(ZS())}),DI=JS({parsed:QS(),program:ZS(),programId:aI}),jI=JS({accounts:WS(aI),data:ZS(),programId:aI}),WI=tx(XS([jI,DI]),XS([JS({parsed:QS(),program:ZS(),programId:ZS()}),JS({accounts:WS(ZS()),data:ZS(),programId:ZS()})]),(t=>NS(t,"accounts"in t?jI:DI))),FI=JS({signatures:WS(ZS()),message:JS({accountKeys:WS(NI),instructions:WS(WI),recentBlockhash:ZS(),addressTableLookups:$S(qS(WS(UI)))})}),KI=JS({accountIndex:HS(),mint:ZS(),owner:$S(ZS()),uiTokenAmount:SI}),VI=JS({writable:WS(aI),readonly:WS(aI)}),qI=JS({err:_I,fee:HS(),innerInstructions:$S(qS(WS(JS({index:HS(),instructions:WS(JS({accounts:WS(HS()),data:ZS(),programIdIndex:HS()}))})))),preBalances:WS(HS()),postBalances:WS(HS()),logMessages:$S(qS(WS(ZS()))),preTokenBalances:$S(qS(WS(KI))),postTokenBalances:$S(qS(WS(KI))),loadedAddresses:$S(VI),computeUnitsConsumed:$S(HS())}),HI=JS({err:_I,fee:HS(),innerInstructions:$S(qS(WS(JS({index:HS(),instructions:WS(WI)})))),preBalances:WS(HS()),postBalances:WS(HS()),logMessages:$S(qS(WS(ZS()))),preTokenBalances:$S(qS(WS(KI))),postTokenBalances:$S(qS(WS(KI))),loadedAddresses:$S(VI),computeUnitsConsumed:$S(HS())}),$I=XS([VS(0),VS("legacy")]),GI=JS({pubkey:ZS(),lamports:HS(),postBalance:qS(HS()),rewardType:qS(ZS()),commission:$S(qS(HS()))});fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:CI,meta:qS(qI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:zI,meta:qS(qI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:FI,meta:qS(HI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:zI,meta:qS(HI),version:$S($I)})),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),rewards:$S(WS(GI)),blockTime:qS(HS()),blockHeight:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),transactions:WS(JS({transaction:CI,meta:qS(qI)})),rewards:$S(WS(GI)),blockTime:qS(HS())}))),fI(qS(JS({blockhash:ZS(),previousBlockhash:ZS(),parentSlot:HS(),signatures:WS(ZS()),blockTime:qS(HS())}))),fI(qS(JS({slot:HS(),meta:qI,blockTime:$S(qS(HS())),transaction:CI,version:$S($I)}))),fI(qS(JS({slot:HS(),transaction:FI,meta:qS(HI),blockTime:$S(qS(HS())),version:$S($I)}))),dI(JS({blockhash:ZS(),feeCalculator:JS({lamportsPerSignature:HS()})})),dI(JS({blockhash:ZS(),lastValidBlockHeight:HS()})),dI(FS()),fI(WS(JS({slot:HS(),numTransactions:HS(),numSlots:HS(),samplePeriodSecs:HS()}))),dI(qS(JS({feeCalculator:JS({lamportsPerSignature:HS()})}))),fI(ZS()),fI(ZS());const ZI=JS({err:_I,logs:WS(ZS()),signature:ZS()});var YI;JS({result:pI(ZI),subscription:HS()}),Object.freeze({CreateLookupTable:{index:0,layout:kS([vS("instruction"),iI("recentSlot"),wS("bumpSeed")])},FreezeLookupTable:{index:1,layout:kS([vS("instruction")])},ExtendLookupTable:{index:2,layout:kS([vS("instruction"),iI(),SS(FA(),mS(vS(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:kS([vS("instruction")])},CloseLookupTable:{index:4,layout:kS([vS("instruction")])}}),new jA("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:kS([wS("instruction"),vS("units"),vS("additionalFee")])},RequestHeapFrame:{index:1,layout:kS([wS("instruction"),vS("bytes")])},SetComputeUnitLimit:{index:2,layout:kS([wS("instruction"),vS("units")])},SetComputeUnitPrice:{index:3,layout:kS([wS("instruction"),iI("microLamports")])}}),new jA("ComputeBudget111111111111111111111111111111"),kS([wS("numSignatures"),wS("padding"),bS("signatureOffset"),bS("signatureInstructionIndex"),bS("publicKeyOffset"),bS("publicKeyInstructionIndex"),bS("messageDataOffset"),bS("messageDataSize"),bS("messageInstructionIndex")]),new jA("Ed25519SigVerify111111111111111111111111111"),RA.utils.isValidPrivateKey,RA.getPublicKey,kS([wS("numSignatures"),bS("signatureOffset"),wS("signatureInstructionIndex"),bS("ethAddressOffset"),wS("ethAddressInstructionIndex"),bS("messageDataOffset"),bS("messageDataSize"),wS("messageInstructionIndex"),xS(20,"ethAddress"),xS(64,"signature"),wS("recoveryId")]),new jA("KeccakSecp256k11111111111111111111111111111"),new jA("StakeConfig11111111111111111111111111111111");class JI{constructor(t,e,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=r}}YI=JI,JI.default=new YI(0,0,jA.default),Object.freeze({Initialize:{index:0,layout:kS([vS("instruction"),((t="authorized")=>kS([FA("staker"),FA("withdrawer")],t))(),((t="lockup")=>kS([ES("unixTimestamp"),ES("epoch"),FA("custodian")],t))()])},Authorize:{index:1,layout:kS([vS("instruction"),FA("newAuthorized"),vS("stakeAuthorizationType")])},Delegate:{index:2,layout:kS([vS("instruction")])},Split:{index:3,layout:kS([vS("instruction"),ES("lamports")])},Withdraw:{index:4,layout:kS([vS("instruction"),ES("lamports")])},Deactivate:{index:5,layout:kS([vS("instruction")])},Merge:{index:7,layout:kS([vS("instruction")])},AuthorizeWithSeed:{index:8,layout:kS([vS("instruction"),FA("newAuthorized"),vS("stakeAuthorizationType"),KA("authoritySeed"),FA("authorityOwner")])}}),Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),new jA("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:kS([vS("instruction"),((t="voteInit")=>kS([FA("nodePubkey"),FA("authorizedVoter"),FA("authorizedWithdrawer"),wS("commission")],t))()])},Authorize:{index:1,layout:kS([vS("instruction"),FA("newAuthorized"),vS("voteAuthorizationType")])},Withdraw:{index:3,layout:kS([vS("instruction"),ES("lamports")])},AuthorizeWithSeed:{index:10,layout:kS([vS("instruction"),((t="voteAuthorizeWithSeedArgs")=>kS([vS("voteAuthorizationType"),FA("currentAuthorityDerivedKeyOwnerPubkey"),KA("currentAuthorityDerivedKeySeed"),FA("newAuthorized")],t))()])}}),Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),new jA("Vote111111111111111111111111111111111111111"),new jA("Va1idator1nfo111111111111111111111111111111"),JS({name:ZS(),website:$S(ZS()),details:$S(ZS()),keybaseUsername:$S(ZS())}),new jA("Vote111111111111111111111111111111111111111"),kS([FA("nodePubkey"),FA("authorizedWithdrawer"),wS("commission"),_S(),SS(kS([_S("slot"),vS("confirmationCount")]),mS(vS(),-8),"votes"),wS("rootSlotValid"),_S("rootSlot"),_S(),SS(kS([_S("epoch"),FA("authorizedVoter")]),mS(vS(),-8),"authorizedVoters"),kS([SS(kS([FA("authorizedPubkey"),_S("epochOfLastAuthorizedSwitch"),_S("targetEpoch")]),32,"buf"),_S("idx"),wS("isEmpty")],"priorVoters"),_S(),SS(kS([_S("epoch"),_S("credits"),_S("prevCredits")]),mS(vS(),-8),"epochCredits"),kS([_S("slot"),_S("timestamp")],"lastTimestamp")]);var XI,QI=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],tB=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}(),eB=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}(),rB=(XI=function(t,e){return XI=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])},XI(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}XI(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function nB(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function iB(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 oB=QI.concat(["bool","string"]),sB=["option","enum","array","set","map","struct"],aB=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return rB(e,t),e}(Error);function uB(t){if("string"!=typeof t||!oB.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&sB.includes(e[0])){var r=e[0];if("option"===r)return uB(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new aB(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');uB({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new aB(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return uB(t.type);throw new aB(t,"{ type, len? }")}(t[r]);if("set"===r)return uB(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new aB(t,"{ key, value }");uB(t.key),uB(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new aB(t,"object");for(var e in t)uB(t[e])}(t[r])}}throw new aB(t,sB.join(", ")+" or "+oB.join(", "))}}var cB=function(){function t(t){this.encoded=new tB,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(QI.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&&nB(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&&nB(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&&nB(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?iB(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?iB(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&&nB(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&&nB(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&&nB(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}(),hB=function(){function t(t){this.buffer=new eB(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(QI.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 lB(t,e,r){return void 0===r&&(r=!0),r&&uB(t),new cB(r).encode(e,t)}class fB{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return lB(fB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}fB.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class dB{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return lB(dB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}dB.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class pB{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return lB(pB.schema,this)}getInstruction(t,e,r,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let h=[];return h.push({pubkey:e,isSigner:!1,isWritable:!1}),h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!0,isWritable:!0}),h.push({pubkey:i,isSigner:!1,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:!1}),h.push({pubkey:u,isSigner:!0,isWritable:!0}),new JA({keys:h,programId:t,data:c})}}pB.schema={struct:{tag:"u8",staleness:"bool"}};class yB{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return lB(yB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}yB.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class gB{constructor(){this.tag=5}serialize(){return lB(gB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}gB.schema={struct:{tag:"u8"}};class mB{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return lB(mB.schema,this)}getInstruction(t,e,r,n,i,o,s,a){const u=Buffer.from(this.serialize());let c=[];return c.push({pubkey:e,isSigner:!1,isWritable:!1}),c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:n,isSigner:!0,isWritable:!0}),c.push({pubkey:i,isSigner:!1,isWritable:!0}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:s,isSigner:!0,isWritable:!0}),c.push({pubkey:a,isSigner:!1,isWritable:!1}),new JA({keys:c,programId:t,data:u})}}mB.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const wB=new jA("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[bB]=jA.findProgramAddressSync([wB.toBuffer()],wB);var vB;!function(t){t[t.None=0]="None",t[t.Solana=1]="Solana",t[t.Ethereum=2]="Ethereum",t[t.UnverifiedSolana=3]="UnverifiedSolana"}(vB||(vB={}));const _B=t=>{switch(t){case vB.None:return 0;case vB.Ethereum:return 20;case vB.Solana:case vB.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class EB{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new EB(function(t,e,r){return void 0===r&&(r=!0),r&&uB(t),new hB(e).decode(t)}(this.schema,t,!0))}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))}}EB.LEN=8,EB.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class kB{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=EB.deserialize(t.slice(96,96+EB.LEN)),r=t.slice(96+EB.LEN);return new kB(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=_B(this.header.stalenessValidation)+_B(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=_B(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=_B(this.header.stalenessValidation),e=t+_B(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var SB;exports.Record=void 0,(SB=exports.Record||(exports.Record={})).IPFS="IPFS",SB.ARWV="ARWV",SB.SOL="SOL",SB.ETH="ETH",SB.BTC="BTC",SB.LTC="LTC",SB.DOGE="DOGE",SB.Email="email",SB.Url="url",SB.Discord="discord",SB.Github="github",SB.Reddit="reddit",SB.Twitter="twitter",SB.Telegram="telegram",SB.Pic="pic",SB.SHDW="SHDW",SB.POINT="POINT",SB.BSC="BSC",SB.Injective="INJ",SB.Backpack="backpack",SB.A="A",SB.AAAA="AAAA",SB.CNAME="CNAME",SB.TXT="TXT",SB.Background="background";const xB=new Map([[exports.Record.SOL,96],[exports.Record.ETH,20],[exports.Record.BSC,20],[exports.Record.Injective,20],[exports.Record.A,4],[exports.Record.AAAA,16],[exports.Record.Background,32]]);var AB;exports.RecordVersion=void 0,(AB=exports.RecordVersion||(exports.RecordVersion={}))[AB.V1=1]="V1",AB[AB.V2=2]="V2";var IB="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=",BB="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",MB=0,RB=-3;function PB(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function TB(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new PB,this.dtree=new PB}var OB=new PB,LB=new PB,UB=new Uint8Array(30),CB=new Uint16Array(30),NB=new Uint8Array(30),zB=new Uint16Array(30),DB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jB=new PB,WB=new Uint8Array(320);function FB(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 KB=new Uint16Array(16);function VB(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)KB[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[KB[e[r+i]]++]=i)}function qB(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function HB(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 $B(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 GB(t,e,r){var n,i,o,s,a,u;for(n=HB(t,5,257),i=HB(t,5,1),o=HB(t,4,4),s=0;s<19;++s)WB[s]=0;for(s=0;s<o;++s){var c=HB(t,3,0);WB[DB[s]]=c}for(VB(jB,WB,0,19),a=0;a<n+i;){var h=$B(t,jB);switch(h){case 16:var l=WB[a-1];for(u=HB(t,2,3);u;--u)WB[a++]=l;break;case 17:for(u=HB(t,3,3);u;--u)WB[a++]=0;break;case 18:for(u=HB(t,7,11);u;--u)WB[a++]=0;break;default:WB[a++]=h}}VB(e,WB,0,n),VB(r,WB,n,i)}function ZB(t,e,r){for(;;){var n,i,o,s,a=$B(t,e);if(256===a)return MB;if(a<256)t.dest[t.destLen++]=a;else for(n=HB(t,UB[a-=257],CB[a]),i=$B(t,r),s=o=t.destLen-HB(t,NB[i],zB[i]);s<o+n;++s)t.dest[t.destLen++]=t.dest[s]}}function YB(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 RB;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,MB}!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}(OB,LB),FB(UB,CB,4,3),FB(NB,zB,2,1),UB[28]=0,CB[28]=258;var JB=function(t,e){var r,n,i=new TB(t,e);do{switch(r=qB(i),HB(i,2,0)){case 0:n=YB(i);break;case 1:n=ZB(i,OB,LB);break;case 2:GB(i,i.ltree,i.dtree),n=ZB(i,i.ltree,i.dtree);break;default:n=RB}if(n!==MB)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 XB=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],QB=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var tM={swap32LE:t=>{XB&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)QB(t,r,r+3),QB(t,r+1,r+2)})(t)}};const eM=JB,{swap32LE:rM}=tM;var nM=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=eM(t,new Uint8Array(r)),t=eM(t,new Uint8Array(r)),rM(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]}},iM={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,iM.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),h=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,l=String.fromCharCode.bind(String),f="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},d=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,m=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(l.apply(null,t.subarray(n,n+e)));return g(r.join(""))},w=function(t,e){return void 0===e&&(e=!1),e?d(m(t)):m(t)},b=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?l(192|e>>>6)+l(128|63&e):l(224|e>>>12&15)+l(128|e>>>6&63)+l(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return l(240|e>>>18&7)+l(128|e>>>12&63)+l(128|e>>>6&63)+l(128|63&e)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function(t){return t.replace(v,b)},E=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return m(s.encode(t))}:function(t){return g(_(t))},k=function(t,e){return void 0===e&&(e=!1),e?d(E(t)):E(t)},S=function(t){return k(t,!0)},x=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,A=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 l(55296+(e>>>10))+l(56320+(1023&e));case 3:return l((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return l((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},I=function(t){return t.replace(x,A)},B=function(t){if(t=t.replace(/\s+/g,""),!h.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?l(e>>16&255):64===n?l(e>>16&255,e>>8&255):l(e>>16&255,e>>8&255,255&e);return i},M=r?function(t){return atob(p(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:B,R=i?function(t){return f(Buffer.from(t,"base64"))}:function(t){return f(M(t).split("").map((function(t){return t.charCodeAt(0)})))},P=function(t){return R(O(t))},T=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:o?function(t){return o.decode(R(t))}:function(t){return I(M(t))},O=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},L=function(t){return T(O(t))},U=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)},C=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},N=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,C(e))};t("fromBase64",(function(){return L(this)})),t("toBase64",(function(t){return k(this,t)})),t("toBase64URI",(function(){return k(this,!0)})),t("toBase64URL",(function(){return k(this,!0)})),t("toUint8Array",(function(){return P(this)}))},z=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,C(e))};t("toBase64",(function(t){return w(this,t)})),t("toBase64URI",(function(){return w(this,!0)})),t("toBase64URL",(function(){return w(this,!0)}))},D=function(){N(),z()},j={version:t,VERSION:e,atob:M,atobPolyfill:B,btoa:g,btoaPolyfill:y,fromBase64:L,toBase64:k,encode:k,encodeURI:S,encodeURL:S,utob:_,btou:I,decode:L,isValid:U,fromUint8Array:w,toUint8Array:P,extendString:N,extendUint8Array:z,extendBuiltins:D,Base64:{}};return Object.keys(j).forEach((function(t){return j.Base64[t]=j[t]})),j}();const oM={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},sM=IB,aM=BB,uM=nM,cM=iM.exports.Base64,hM=new uM(cM.toUint8Array(sM)),lM=new uM(cM.toUint8Array(aM));function fM(t,e){return 0!=(t&e)}const dM=0,pM=1,yM=2;function gM(t,e){const r=t.length;let n=0,i=dM;for(let o=e;o+1<r;o++){const r=t[o+0],s=t[o+1];switch(fM(r,oM.Regional_Indicator)||(n=0),i){case yM:case dM:i=fM(r,oM.Extended_Pictographic)?pM:dM;break;case pM:i=fM(r,oM.Extend)?pM:fM(r,oM.ZWJ)&&fM(s,oM.Extended_Pictographic)?yM:dM}if(!fM(r,oM.CR)||!fM(s,oM.LF)){if(fM(r,oM.Control|oM.CR|oM.LF))return o+1-e;if(fM(s,oM.Control|oM.CR|oM.LF))return o+1-e;if(!(fM(r,oM.L)&&fM(s,oM.L|oM.V|oM.LV|oM.LVT)||fM(r,oM.LV|oM.V)&&fM(s,oM.V|oM.T)||fM(r,oM.LVT|oM.T)&&fM(s,oM.T)||fM(s,oM.Extend|oM.ZWJ)||fM(s,oM.SpacingMark)||fM(r,oM.Prepend)||i===yM)){if(!fM(r,oM.Regional_Indicator)||!fM(s,oM.Regional_Indicator)||n%2!=0)return o+1-e;n++}}}return r-e}var mM=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const i=t.codePointAt(e);n.push(hM.get(i)|lM.get(i)),e+=i>65535?2:1,r.push(e)}for(let i=0;i<n.length;){const o=gM(n,i),s=r[i],a=r[i+o];e.push(t.slice(s,a)),i+=o}return e},wM=e(mM);const bM=t=>{const e=Sf+t,r=Ef(n.Buffer.from(e,"utf8")).slice(2);return n.Buffer.from(r,"hex")},vM=(t,e,r)=>{const i=[t];e?i.push(e.toBuffer()):i.push(n.Buffer.alloc(32)),r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32));const[o]=Wo.findProgramAddressSync(i,kf);return o};async function _M(t,e){const r=bM(e.toBase58()),n=vM(r,Mf),{registry:i}=await oh.retrieve(t,n);if(!i.data)throw new Dc(exports.ErrorType.NoAccountData);const o=new ne(i.data.slice(0,4),"le").toNumber();return i.data.slice(4,4+o).toString()}async function EM(t,e){let r=[];for(let t of e){const e=bM(t.toBase58()),n=vM(e,Mf);r.push(n)}return(await oh.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;let e=new ne(t.data.slice(0,4),"le").toNumber();return t.data.slice(4,4+e).toString()}))}const kM=(t,e=xf,r)=>{let n=bM(t);return{pubkey:vM(n,r,e),hashed:n}},SM=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?bB:void 0,i=t.split(".");if(2===i.length){const t=n.Buffer.from([e||0]).toString().concat(i[0]),{pubkey:o}=kM(i[1]);return{...kM(t,o,r),isSub:!0,parent:o}}if(3===i.length&&e){const{pubkey:t}=kM(i[2]),{pubkey:n}=kM("\0".concat(i[1]),t),o=e===exports.RecordVersion.V2?"":"";return{...kM(o.concat(i[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(i.length>=3)throw new Dc(exports.ErrorType.InvalidInput);return{...kM(t,xf),isSub:!1,parent:void 0}};async function xM(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:xf.toBase58()}}];return(await t.getProgramAccounts(kf,{filters:r})).map((t=>t.pubkey))}const AM=(t,e)=>{const{pubkey:r,parent:n}=SM(t),i=bM(r.toBase58());return vM(i,Mf,e?n:void 0)},IM=(t,e)=>{const r=bM(t.toBase58());return vM(r,Mf,e)},BM=(t,e)=>{if(!t)throw new Dc(e)},MM=t=>{if(!t)return;const e=new ne(t.slice(0,4),"le").toNumber();return t.slice(4,4+e).toString()};var RM={},PM={};function TM(t,e,r,n,i){var o=(1<<n)-1,s=0,a=0,u=0;if(t.forEach((function(t){for(s=(s<<e)+t,a+=e;a>=n;)a-=n,r[u]=s>>a&o,u+=1})),i)a>0&&(r[u]=s<<n-a&o);else{if(a>=e)throw new Error("Excessive padding: ".concat(a," (max ").concat(e-1," allowed)"));if(s%(1<<a)!=0)throw new Error("Non-zero padding")}}Object.defineProperty(PM,"__esModule",{value:!0}),PM.createBitArray=function(t){return new Uint8Array(t)},PM.fromBits=function(t,e,r){if(e>8||e<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return TM(t,e,r,8,!1),r},PM.toBits=function(t,e,r){if(e>8||e<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return TM(t,8,r,e,!0),r};var OM={};Object.defineProperty(OM,"__esModule",{value:!0}),OM.CHECKSUM_LENGTH=void 0,OM.createChecksum=function(t,e){var r;switch(e){case"bech32":r=1;break;case"bech32m":r=CM;break;default:throw Error("Invalid encoding value: ".concat(e,"; expected bech32 or bech32m"))}for(var n=FM(t)^r,i=0;i<DM;i+=1){var o=5*(5-i);t[t.length-DM+i]=n>>o&31}},OM.decode=VM,OM.decodeWithPrefix=function(t,e){var r=e.length+2*t.length+1,n=(0,LM.createBitArray)(r);return KM(t,n.subarray(0,2*t.length+1)),VM(e,n.subarray(2*t.length+1)),n},OM.detectCase=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"message",r=!1,n=!1,i=0;i<t.length;i+=1){var o=t.charCodeAt(i);if(o<NM||o>zM)throw new TypeError("Invalid char in ".concat(e,": ").concat(o,"; ")+"should be in ASCII range ".concat(NM,"-").concat(zM));n=n||o>=65&&o<=90,r=r||o>=97&&o<=122}if(r&&n)throw new TypeError("Mixed-case ".concat(e));return n?"upper":r?"lower":null},OM.encode=function(t){return t.reduce((function(t,e){return t+UM[e]}),"")},OM.expandPrefix=KM,OM.verifyChecksum=function(t){switch(FM(t)){case 1:return"bech32";case CM:return"bech32m";default:return}};var LM=PM,UM="qpzry9x8gf2tvdw0s3jn54khce6mua7l",CM=734539939,NM=33,zM=126,DM=6;OM.CHECKSUM_LENGTH=DM;var jM=function(){for(var t=new Map,e=0;e<UM.length;e+=1)t.set(UM[e],e);return t}(),WM=[996825010,642813549,513874426,1027748829,705979059];function FM(t){return t.reduce((function(t,e){var r=t>>25,n=(33554431&t)<<5^e;return WM.reduce((function(t,e,n){return 0==(r>>n&1)?t:t^e}),n)}),1)}function KM(t,e){for(var r=0;r<t.length;r+=1){var n=t.charCodeAt(r);e[r]=n>>5,e[r+t.length+1]=31&n}e[t.length]=0}function VM(t,e){for(var r=e||(0,LM.createBitArray)(t.length),n=0;n<t.length;n+=1){var i=jM.get(t[n]);if(void 0===i)throw new Error("Invalid char in message: ".concat(t[n]));r[n]=i}return r}Object.defineProperty(RM,"__esModule",{value:!0}),RM.BitcoinAddress=void 0;var qM=RM.decode=function(t){var e=tR(t),r=e.prefix,n=e.encoding,i=e.data;return{prefix:r,encoding:n,data:XM(i)}};RM.decodeTo5BitArray=tR;var HM=RM.encode=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"bech32";return QM(t,JM(e),r)};RM.encode5BitArray=QM,RM.from5BitArray=XM,RM.to5BitArray=JM;var $M=PM,GM=OM;function ZM(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var YM=90;function JM(t,e){var r=Math.ceil(8*t.length/5),n=e||(0,$M.createBitArray)(r);return(0,$M.toBits)(t,5,n)}function XM(t,e){var r=Math.floor(5*t.length/8),n=e||new Uint8Array(r);return(0,$M.fromBits)(t,5,n)}function QM(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"bech32",i=2*t.length+1+e.length+GM.CHECKSUM_LENGTH;if(i-t.length>YM)throw new Error("Message to be produced is too long (max ".concat(YM," supported)"));var o=null!==(r=(0,GM.detectCase)(t,"prefix"))&&void 0!==r?r:"lower",s=(0,$M.createBitArray)(i);(0,GM.expandPrefix)(t.toLowerCase(),s.subarray(0,2*t.length+1)),s.subarray(2*t.length+1,s.length-GM.CHECKSUM_LENGTH).set(e),(0,GM.createChecksum)(s,n);var a=(0,GM.encode)(s.subarray(2*t.length+1));return"upper"===o&&(a=a.toUpperCase()),"".concat(t,"1").concat(a)}function tR(t){if(t.length>YM)throw new TypeError("Message too long; max ".concat(YM," expected"));(0,GM.detectCase)(t);var e=t.toLowerCase(),r=e.lastIndexOf("1");if(r<0)throw new Error('No separator char ("1") found');if(r>t.length-GM.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(GM.CHECKSUM_LENGTH," chars expected)"));var n=e.substring(0,r),i=(0,GM.decodeWithPrefix)(n,e.substring(r+1)),o=(0,GM.verifyChecksum)(i);if(void 0===o)throw new Error("Invalid checksum");return{prefix:n,encoding:o,data:i.subarray(2*n.length+1,i.length-GM.CHECKSUM_LENGTH)}}var eR=function(){function t(e,r,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"bc"!==e&&"tb"!==e)throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(r<0||r>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(n.length<2||n.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(0===r&&20!==n.length&&32!==n.length)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=e,this.scriptVersion=r,this.data=n}var e,r,n;return e=t,r=[{key:"type",value:function(){if(0===this.scriptVersion)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var t=Math.ceil(8*this.data.length/5),e=(0,$M.createBitArray)(t+1);e[0]=this.scriptVersion,JM(this.data,e.subarray(1));var r=0===this.scriptVersion?"bech32":"bech32m";return QM(this.prefix,e,r)}}],n=[{key:"decode",value:function(t){var e=tR(t),r=e.prefix,n=e.data,i=e.encoding;if("bc"!==r&&"tb"!==r)throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var o=n[0];if(0===o&&"bech32"!==i)throw Error("Unexpected encoding ".concat(i," used for version 0 script"));if(o>0&&"bech32m"!==i)throw Error("Unexpected encoding ".concat(i," used for version ").concat(o," script"));return new this(r,o,XM(n.subarray(1)))}}],r&&ZM(e.prototype,r),n&&ZM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();RM.BitcoinAddress=eR;var rR={exports:{}};!function(e){!function(t){const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${s})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(t.match(u.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 h(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 l(t){if(o.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(i.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function f(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 h(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,r,i;if(e=t.match(n.fourOctet))return function(){const t=e.slice(1,6),n=[];for(let e=0;e<t.length;e++)r=t[e],n.push(l(r));return n}();if(e=t.match(n.longValue)){if(i=l(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(n.twoOctet))?function(){const t=e.slice(1,4),r=[];if(i=l(t[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(e=t.match(n.threeOctet))?function(){const t=e.slice(1,5),r=[];if(i=l(t[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(t[0])),r.push(l(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 h(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(f(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(u.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(u.native.test(t))return c(t,8);if((n=t.match(u.transitional))&&(s=n[6]||"",e=c(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},e.exports?e.exports=d:t.ipaddr=d}(t)}(rR);var nR=e(rR.exports);const iR=2147483647,oR=36,sR={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},aR=Math.floor,uR=String.fromCharCode;function cR(t){throw new RangeError(sR[t])}const hR=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},lR=function(t,e,r){let n=0;for(t=r?aR(t/700):t>>1,t+=aR(t/e);t>455;n+=oR)t=aR(t/35);return aR(n+36*t/(t+38))},fR=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(uR(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=iR;for(const e of t)e>=n&&e<r&&(r=e);const u=a+1;r-n>aR((iR-i)/u)&&cR("overflow"),i+=(r-n)*u,n=r;for(const r of t)if(r<n&&++i>iR&&cR("overflow"),r===n){let t=i;for(let r=oR;;r+=oR){const n=r<=o?1:r>=o+26?26:r-o;if(t<n)break;const i=t-n,s=oR-n;e.push(uR(hR(n+i%s,0))),t=aR(i/s)}e.push(uR(hR(t,0))),o=lR(i,u,a===s),i=0,++a}++i,++n}return e.join("")};function dR(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pR={exports:{}};!function(t){var e=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e<t.length;e++)r[e]=t[e];return r},r=function(){throw new Error("no PRNG")},n=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=e(),s=e([1]),a=e([56129,1]),u=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(t,e,r,n){t[e]=r>>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=n>>24&255,t[e+5]=n>>16&255,t[e+6]=n>>8&255,t[e+7]=255&n}function p(t,e,r,n,i){var o,s=0;for(o=0;o<i;o++)s|=t[e+o]^r[n+o];return(1&s-1>>>8)-1}function y(t,e,r,n){return p(t,e,r,n,16)}function g(t,e,r,n){return p(t,e,r,n,32)}function m(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,E=s,k=a,S=u,x=c,A=h,I=l,B=f,M=d,R=p,P=y,T=g,O=m,L=w,U=b,C=v,N=0;N<20;N+=2)_^=(i=(O^=(i=(M^=(i=(x^=(i=_+O|0)<<7|i>>>25)+_|0)<<9|i>>>23)+x|0)<<13|i>>>19)+M|0)<<18|i>>>14,A^=(i=(E^=(i=(L^=(i=(R^=(i=A+E|0)<<7|i>>>25)+A|0)<<9|i>>>23)+R|0)<<13|i>>>19)+L|0)<<18|i>>>14,P^=(i=(I^=(i=(k^=(i=(U^=(i=P+I|0)<<7|i>>>25)+P|0)<<9|i>>>23)+U|0)<<13|i>>>19)+k|0)<<18|i>>>14,C^=(i=(T^=(i=(B^=(i=(S^=(i=C+T|0)<<7|i>>>25)+C|0)<<9|i>>>23)+S|0)<<13|i>>>19)+B|0)<<18|i>>>14,_^=(i=(S^=(i=(k^=(i=(E^=(i=_+S|0)<<7|i>>>25)+_|0)<<9|i>>>23)+E|0)<<13|i>>>19)+k|0)<<18|i>>>14,A^=(i=(x^=(i=(B^=(i=(I^=(i=A+x|0)<<7|i>>>25)+A|0)<<9|i>>>23)+I|0)<<13|i>>>19)+B|0)<<18|i>>>14,P^=(i=(R^=(i=(M^=(i=(T^=(i=P+R|0)<<7|i>>>25)+P|0)<<9|i>>>23)+T|0)<<13|i>>>19)+M|0)<<18|i>>>14,C^=(i=(U^=(i=(L^=(i=(O^=(i=C+U|0)<<7|i>>>25)+C|0)<<9|i>>>23)+O|0)<<13|i>>>19)+L|0)<<18|i>>>14;_=_+o|0,E=E+s|0,k=k+a|0,S=S+u|0,x=x+c|0,A=A+h|0,I=I+l|0,B=B+f|0,M=M+d|0,R=R+p|0,P=P+y|0,T=T+g|0,O=O+m|0,L=L+w|0,U=U+b|0,C=C+v|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=E>>>0&255,t[5]=E>>>8&255,t[6]=E>>>16&255,t[7]=E>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=S>>>0&255,t[13]=S>>>8&255,t[14]=S>>>16&255,t[15]=S>>>24&255,t[16]=x>>>0&255,t[17]=x>>>8&255,t[18]=x>>>16&255,t[19]=x>>>24&255,t[20]=A>>>0&255,t[21]=A>>>8&255,t[22]=A>>>16&255,t[23]=A>>>24&255,t[24]=I>>>0&255,t[25]=I>>>8&255,t[26]=I>>>16&255,t[27]=I>>>24&255,t[28]=B>>>0&255,t[29]=B>>>8&255,t[30]=B>>>16&255,t[31]=B>>>24&255,t[32]=M>>>0&255,t[33]=M>>>8&255,t[34]=M>>>16&255,t[35]=M>>>24&255,t[36]=R>>>0&255,t[37]=R>>>8&255,t[38]=R>>>16&255,t[39]=R>>>24&255,t[40]=P>>>0&255,t[41]=P>>>8&255,t[42]=P>>>16&255,t[43]=P>>>24&255,t[44]=T>>>0&255,t[45]=T>>>8&255,t[46]=T>>>16&255,t[47]=T>>>24&255,t[48]=O>>>0&255,t[49]=O>>>8&255,t[50]=O>>>16&255,t[51]=O>>>24&255,t[52]=L>>>0&255,t[53]=L>>>8&255,t[54]=L>>>16&255,t[55]=L>>>24&255,t[56]=U>>>0&255,t[57]=U>>>8&255,t[58]=U>>>16&255,t[59]=U>>>24&255,t[60]=C>>>0&255,t[61]=C>>>8&255,t[62]=C>>>16&255,t[63]=C>>>24&255}(t,e,r,n)}function w(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,d=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(m^=(i=(d^=(i=(c^=(i=o+m|0)<<7|i>>>25)+o|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,h^=(i=(s^=(i=(w^=(i=(p^=(i=h+s|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+w|0)<<18|i>>>14,y^=(i=(l^=(i=(a^=(i=(b^=(i=y+l|0)<<7|i>>>25)+y|0)<<9|i>>>23)+b|0)<<13|i>>>19)+a|0)<<18|i>>>14,v^=(i=(g^=(i=(f^=(i=(u^=(i=v+g|0)<<7|i>>>25)+v|0)<<9|i>>>23)+u|0)<<13|i>>>19)+f|0)<<18|i>>>14,o^=(i=(u^=(i=(a^=(i=(s^=(i=o+u|0)<<7|i>>>25)+o|0)<<9|i>>>23)+s|0)<<13|i>>>19)+a|0)<<18|i>>>14,h^=(i=(c^=(i=(f^=(i=(l^=(i=h+c|0)<<7|i>>>25)+h|0)<<9|i>>>23)+l|0)<<13|i>>>19)+f|0)<<18|i>>>14,y^=(i=(p^=(i=(d^=(i=(g^=(i=y+p|0)<<7|i>>>25)+y|0)<<9|i>>>23)+g|0)<<13|i>>>19)+d|0)<<18|i>>>14,v^=(i=(b^=(i=(w^=(i=(m^=(i=v+b|0)<<7|i>>>25)+v|0)<<9|i>>>23)+m|0)<<13|i>>>19)+w|0)<<18|i>>>14;t[0]=o>>>0&255,t[1]=o>>>8&255,t[2]=o>>>16&255,t[3]=o>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=v>>>0&255,t[13]=v>>>8&255,t[14]=v>>>16&255,t[15]=v>>>24&255,t[16]=l>>>0&255,t[17]=l>>>8&255,t[18]=l>>>16&255,t[19]=l>>>24&255,t[20]=f>>>0&255,t[21]=f>>>8&255,t[22]=f>>>16&255,t[23]=f>>>24&255,t[24]=d>>>0&255,t[25]=d>>>8&255,t[26]=d>>>16&255,t[27]=d>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function v(t,e,r,n,i,o,s){var a,u,c=new Uint8Array(16),h=new Uint8Array(64);for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=o[u];for(;i>=64;){for(m(h,c,s,b),u=0;u<64;u++)t[e+u]=r[n+u]^h[u];for(a=1,u=8;u<16;u++)a=a+(255&c[u])|0,c[u]=255&a,a>>>=8;i-=64,e+=64,n+=64}if(i>0)for(m(h,c,s,b),u=0;u<i;u++)t[e+u]=r[n+u]^h[u];return 0}function _(t,e,r,n,i){var o,s,a=new Uint8Array(16),u=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=n[s];for(;r>=64;){for(m(u,a,i,b),s=0;s<64;s++)t[e+s]=u[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,e+=64}if(r>0)for(m(u,a,i,b),s=0;s<r;s++)t[e+s]=u[s];return 0}function E(t,e,r,n,i){var o=new Uint8Array(32);w(o,n,i,b);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=n[a+16];return _(t,e,r,s,o)}function k(t,e,r,n,i,o,s){var a=new Uint8Array(32);w(a,o,s,b);for(var u=new Uint8Array(8),c=0;c<8;c++)u[c]=o[c+16];return v(t,e,r,n,i,u,a)}var S=function(t){var e,r,n,i,o,s,a,u;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,e=255&t[0]|(255&t[1])<<8,this.r[0]=8191&e,r=255&t[2]|(255&t[3])<<8,this.r[1]=8191&(e>>>13|r<<3),n=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&t[8]|(255&t[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function x(t,e,r,n,i,o){var s=new S(o);return s.update(r,n,i),s.finish(t,e),0}function A(t,e,r,n,i,o){var s=new Uint8Array(16);return x(s,0,r,n,i,o),y(t,e,s,0)}function I(t,e,r,n,i){var o;if(r<32)return-1;for(k(t,0,e,0,r,n,i),x(t,16,t,32,r-32,t),o=0;o<16;o++)t[o]=0;return 0}function B(t,e,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(E(s,0,32,n,i),0!==A(e,16,e,32,r-32,s))return-1;for(k(t,0,e,0,r,n,i),o=0;o<32;o++)t[o]=0;return 0}function M(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function R(t){var e,r,n=1;for(e=0;e<16;e++)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function P(t,e,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(t[o]^e[o]),t[o]^=n,e[o]^=n}function T(t,r){var n,i,o,s=e(),a=e();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,P(a,s,1-o)}for(n=0;n<16;n++)t[2*n]=255&a[n],t[2*n+1]=a[n]>>8}function O(t,e){var r=new Uint8Array(32),n=new Uint8Array(32);return T(r,t),T(n,e),g(r,0,n,0)}function L(t){var e=new Uint8Array(32);return T(e,t),1&e[0]}function U(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function C(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function N(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function z(t,e,r){var n,i,o=0,s=0,a=0,u=0,c=0,h=0,l=0,f=0,d=0,p=0,y=0,g=0,m=0,w=0,b=0,v=0,_=0,E=0,k=0,S=0,x=0,A=0,I=0,B=0,M=0,R=0,P=0,T=0,O=0,L=0,U=0,C=r[0],N=r[1],z=r[2],D=r[3],j=r[4],W=r[5],F=r[6],K=r[7],V=r[8],q=r[9],H=r[10],$=r[11],G=r[12],Z=r[13],Y=r[14],J=r[15];o+=(n=e[0])*C,s+=n*N,a+=n*z,u+=n*D,c+=n*j,h+=n*W,l+=n*F,f+=n*K,d+=n*V,p+=n*q,y+=n*H,g+=n*$,m+=n*G,w+=n*Z,b+=n*Y,v+=n*J,s+=(n=e[1])*C,a+=n*N,u+=n*z,c+=n*D,h+=n*j,l+=n*W,f+=n*F,d+=n*K,p+=n*V,y+=n*q,g+=n*H,m+=n*$,w+=n*G,b+=n*Z,v+=n*Y,_+=n*J,a+=(n=e[2])*C,u+=n*N,c+=n*z,h+=n*D,l+=n*j,f+=n*W,d+=n*F,p+=n*K,y+=n*V,g+=n*q,m+=n*H,w+=n*$,b+=n*G,v+=n*Z,_+=n*Y,E+=n*J,u+=(n=e[3])*C,c+=n*N,h+=n*z,l+=n*D,f+=n*j,d+=n*W,p+=n*F,y+=n*K,g+=n*V,m+=n*q,w+=n*H,b+=n*$,v+=n*G,_+=n*Z,E+=n*Y,k+=n*J,c+=(n=e[4])*C,h+=n*N,l+=n*z,f+=n*D,d+=n*j,p+=n*W,y+=n*F,g+=n*K,m+=n*V,w+=n*q,b+=n*H,v+=n*$,_+=n*G,E+=n*Z,k+=n*Y,S+=n*J,h+=(n=e[5])*C,l+=n*N,f+=n*z,d+=n*D,p+=n*j,y+=n*W,g+=n*F,m+=n*K,w+=n*V,b+=n*q,v+=n*H,_+=n*$,E+=n*G,k+=n*Z,S+=n*Y,x+=n*J,l+=(n=e[6])*C,f+=n*N,d+=n*z,p+=n*D,y+=n*j,g+=n*W,m+=n*F,w+=n*K,b+=n*V,v+=n*q,_+=n*H,E+=n*$,k+=n*G,S+=n*Z,x+=n*Y,A+=n*J,f+=(n=e[7])*C,d+=n*N,p+=n*z,y+=n*D,g+=n*j,m+=n*W,w+=n*F,b+=n*K,v+=n*V,_+=n*q,E+=n*H,k+=n*$,S+=n*G,x+=n*Z,A+=n*Y,I+=n*J,d+=(n=e[8])*C,p+=n*N,y+=n*z,g+=n*D,m+=n*j,w+=n*W,b+=n*F,v+=n*K,_+=n*V,E+=n*q,k+=n*H,S+=n*$,x+=n*G,A+=n*Z,I+=n*Y,B+=n*J,p+=(n=e[9])*C,y+=n*N,g+=n*z,m+=n*D,w+=n*j,b+=n*W,v+=n*F,_+=n*K,E+=n*V,k+=n*q,S+=n*H,x+=n*$,A+=n*G,I+=n*Z,B+=n*Y,M+=n*J,y+=(n=e[10])*C,g+=n*N,m+=n*z,w+=n*D,b+=n*j,v+=n*W,_+=n*F,E+=n*K,k+=n*V,S+=n*q,x+=n*H,A+=n*$,I+=n*G,B+=n*Z,M+=n*Y,R+=n*J,g+=(n=e[11])*C,m+=n*N,w+=n*z,b+=n*D,v+=n*j,_+=n*W,E+=n*F,k+=n*K,S+=n*V,x+=n*q,A+=n*H,I+=n*$,B+=n*G,M+=n*Z,R+=n*Y,P+=n*J,m+=(n=e[12])*C,w+=n*N,b+=n*z,v+=n*D,_+=n*j,E+=n*W,k+=n*F,S+=n*K,x+=n*V,A+=n*q,I+=n*H,B+=n*$,M+=n*G,R+=n*Z,P+=n*Y,T+=n*J,w+=(n=e[13])*C,b+=n*N,v+=n*z,_+=n*D,E+=n*j,k+=n*W,S+=n*F,x+=n*K,A+=n*V,I+=n*q,B+=n*H,M+=n*$,R+=n*G,P+=n*Z,T+=n*Y,O+=n*J,b+=(n=e[14])*C,v+=n*N,_+=n*z,E+=n*D,k+=n*j,S+=n*W,x+=n*F,A+=n*K,I+=n*V,B+=n*q,M+=n*H,R+=n*$,P+=n*G,T+=n*Z,O+=n*Y,L+=n*J,v+=(n=e[15])*C,s+=38*(E+=n*z),a+=38*(k+=n*D),u+=38*(S+=n*j),c+=38*(x+=n*W),h+=38*(A+=n*F),l+=38*(I+=n*K),f+=38*(B+=n*V),d+=38*(M+=n*q),p+=38*(R+=n*H),y+=38*(P+=n*$),g+=38*(T+=n*G),m+=38*(O+=n*Z),w+=38*(L+=n*Y),b+=38*(U+=n*J),o=(n=(o+=38*(_+=n*N))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),t[0]=o,t[1]=s,t[2]=a,t[3]=u,t[4]=c,t[5]=h,t[6]=l,t[7]=f,t[8]=d,t[9]=p,t[10]=y,t[11]=g,t[12]=m,t[13]=w,t[14]=b,t[15]=v}function D(t,e){z(t,e,e)}function j(t,r){var n,i=e();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)D(i,i),2!==n&&4!==n&&z(i,i,r);for(n=0;n<16;n++)t[n]=i[n]}function W(t,r){var n,i=e();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)D(i,i),1!==n&&z(i,i,r);for(n=0;n<16;n++)t[n]=i[n]}function F(t,r,n){var i,o,s=new Uint8Array(32),u=new Float64Array(80),c=e(),h=e(),l=e(),f=e(),d=e(),p=e();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,U(u,n),o=0;o<16;o++)h[o]=u[o],f[o]=c[o]=l[o]=0;for(c[0]=f[0]=1,o=254;o>=0;--o)P(c,h,i=s[o>>>3]>>>(7&o)&1),P(l,f,i),C(d,c,l),N(c,c,l),C(l,h,f),N(h,h,f),D(f,d),D(p,c),z(c,l,c),z(l,h,d),C(d,c,l),N(c,c,l),D(h,c),N(l,f,p),z(c,l,a),C(c,c,f),z(l,l,c),z(c,f,p),z(f,h,u),D(h,d),P(c,h,i),P(l,f,i);for(o=0;o<16;o++)u[o+16]=c[o],u[o+32]=l[o],u[o+48]=h[o],u[o+64]=f[o];var y=u.subarray(32),g=u.subarray(16);return j(y,y),z(g,g,y),T(t,g),0}function K(t,e){return F(t,e,i)}function V(t,e){return r(e,32),K(t,e)}function q(t,e,r){var i=new Uint8Array(32);return F(i,r,e),w(t,n,i,b)}S.prototype.blocks=function(t,e,r){for(var n,i,o,s,a,u,c,h,l,f,d,p,y,g,m,w,b,v,_,E=this.fin?0:2048,k=this.h[0],S=this.h[1],x=this.h[2],A=this.h[3],I=this.h[4],B=this.h[5],M=this.h[6],R=this.h[7],P=this.h[8],T=this.h[9],O=this.r[0],L=this.r[1],U=this.r[2],C=this.r[3],N=this.r[4],z=this.r[5],D=this.r[6],j=this.r[7],W=this.r[8],F=this.r[9];r>=16;)f=l=0,f+=(k+=8191&(n=255&t[e+0]|(255&t[e+1])<<8))*O,f+=(S+=8191&(n>>>13|(i=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*F),f+=(x+=8191&(i>>>10|(o=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*W),f+=(A+=8191&(o>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*j),l=(f+=(I+=8191&(s>>>4|(a=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*D))>>>13,f&=8191,f+=(B+=a>>>1&8191)*(5*z),f+=(M+=8191&(a>>>14|(u=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),f+=(R+=8191&(u>>>11|(c=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*C),f+=(P+=8191&(c>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*U),d=l+=(f+=(T+=h>>>5|E)*(5*L))>>>13,d+=k*L,d+=S*O,d+=x*(5*F),d+=A*(5*W),l=(d+=I*(5*j))>>>13,d&=8191,d+=B*(5*D),d+=M*(5*z),d+=R*(5*N),d+=P*(5*C),l+=(d+=T*(5*U))>>>13,d&=8191,p=l,p+=k*U,p+=S*L,p+=x*O,p+=A*(5*F),l=(p+=I*(5*W))>>>13,p&=8191,p+=B*(5*j),p+=M*(5*D),p+=R*(5*z),p+=P*(5*N),y=l+=(p+=T*(5*C))>>>13,y+=k*C,y+=S*U,y+=x*L,y+=A*O,l=(y+=I*(5*F))>>>13,y&=8191,y+=B*(5*W),y+=M*(5*j),y+=R*(5*D),y+=P*(5*z),g=l+=(y+=T*(5*N))>>>13,g+=k*N,g+=S*C,g+=x*U,g+=A*L,l=(g+=I*O)>>>13,g&=8191,g+=B*(5*F),g+=M*(5*W),g+=R*(5*j),g+=P*(5*D),m=l+=(g+=T*(5*z))>>>13,m+=k*z,m+=S*N,m+=x*C,m+=A*U,l=(m+=I*L)>>>13,m&=8191,m+=B*O,m+=M*(5*F),m+=R*(5*W),m+=P*(5*j),w=l+=(m+=T*(5*D))>>>13,w+=k*D,w+=S*z,w+=x*N,w+=A*C,l=(w+=I*U)>>>13,w&=8191,w+=B*L,w+=M*O,w+=R*(5*F),w+=P*(5*W),b=l+=(w+=T*(5*j))>>>13,b+=k*j,b+=S*D,b+=x*z,b+=A*N,l=(b+=I*C)>>>13,b&=8191,b+=B*U,b+=M*L,b+=R*O,b+=P*(5*F),v=l+=(b+=T*(5*W))>>>13,v+=k*W,v+=S*j,v+=x*D,v+=A*z,l=(v+=I*N)>>>13,v&=8191,v+=B*C,v+=M*U,v+=R*L,v+=P*O,_=l+=(v+=T*(5*F))>>>13,_+=k*F,_+=S*W,_+=x*j,_+=A*D,l=(_+=I*z)>>>13,_&=8191,_+=B*N,_+=M*C,_+=R*U,_+=P*L,k=f=8191&(l=(l=((l+=(_+=T*O)>>>13)<<2)+l|0)+(f&=8191)|0),S=d+=l>>>=13,x=p&=8191,A=y&=8191,I=g&=8191,B=m&=8191,M=w&=8191,R=b&=8191,P=v&=8191,T=_&=8191,e+=16,r-=16;this.h[0]=k,this.h[1]=S,this.h[2]=x,this.h[3]=A,this.h[4]=I,this.h[5]=B,this.h[6]=M,this.h[7]=R,this.h[8]=P,this.h[9]=T},S.prototype.finish=function(t,e){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},S.prototype.update=function(t,e,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n<i;n++)this.buffer[this.leftover+n]=t[e+n];if(r-=i,e+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(i=r-r%16,this.blocks(t,e,i),e+=i,r-=i),r){for(n=0;n<r;n++)this.buffer[this.leftover+n]=t[e+n];this.leftover+=r}};var H=I,$=B,G=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Z(t,e,r,n){for(var i,o,s,a,u,c,h,l,f,d,p,y,g,m,w,b,v,_,E,k,S,x,A,I,B,M,R=new Int32Array(16),P=new Int32Array(16),T=t[0],O=t[1],L=t[2],U=t[3],C=t[4],N=t[5],z=t[6],D=t[7],j=e[0],W=e[1],F=e[2],K=e[3],V=e[4],q=e[5],H=e[6],$=e[7],Z=0;n>=128;){for(E=0;E<16;E++)k=8*E+Z,R[E]=r[k+0]<<24|r[k+1]<<16|r[k+2]<<8|r[k+3],P[E]=r[k+4]<<24|r[k+5]<<16|r[k+6]<<8|r[k+7];for(E=0;E<80;E++)if(i=T,o=O,s=L,a=U,u=C,c=N,h=z,f=j,d=W,p=F,y=K,g=V,m=q,w=H,A=65535&(x=$),I=x>>>16,B=65535&(S=D),M=S>>>16,A+=65535&(x=(V>>>14|C<<18)^(V>>>18|C<<14)^(C>>>9|V<<23)),I+=x>>>16,B+=65535&(S=(C>>>14|V<<18)^(C>>>18|V<<14)^(V>>>9|C<<23)),M+=S>>>16,A+=65535&(x=V&q^~V&H),I+=x>>>16,B+=65535&(S=C&N^~C&z),M+=S>>>16,S=G[2*E],A+=65535&(x=G[2*E+1]),I+=x>>>16,B+=65535&S,M+=S>>>16,S=R[E%16],I+=(x=P[E%16])>>>16,B+=65535&S,M+=S>>>16,B+=(I+=(A+=65535&x)>>>16)>>>16,A=65535&(x=_=65535&A|I<<16),I=x>>>16,B=65535&(S=v=65535&B|(M+=B>>>16)<<16),M=S>>>16,A+=65535&(x=(j>>>28|T<<4)^(T>>>2|j<<30)^(T>>>7|j<<25)),I+=x>>>16,B+=65535&(S=(T>>>28|j<<4)^(j>>>2|T<<30)^(j>>>7|T<<25)),M+=S>>>16,I+=(x=j&W^j&F^W&F)>>>16,B+=65535&(S=T&O^T&L^O&L),M+=S>>>16,l=65535&(B+=(I+=(A+=65535&x)>>>16)>>>16)|(M+=B>>>16)<<16,b=65535&A|I<<16,A=65535&(x=y),I=x>>>16,B=65535&(S=a),M=S>>>16,I+=(x=_)>>>16,B+=65535&(S=v),M+=S>>>16,O=i,L=o,U=s,C=a=65535&(B+=(I+=(A+=65535&x)>>>16)>>>16)|(M+=B>>>16)<<16,N=u,z=c,D=h,T=l,W=f,F=d,K=p,V=y=65535&A|I<<16,q=g,H=m,$=w,j=b,E%16==15)for(k=0;k<16;k++)S=R[k],A=65535&(x=P[k]),I=x>>>16,B=65535&S,M=S>>>16,S=R[(k+9)%16],A+=65535&(x=P[(k+9)%16]),I+=x>>>16,B+=65535&S,M+=S>>>16,v=R[(k+1)%16],A+=65535&(x=((_=P[(k+1)%16])>>>1|v<<31)^(_>>>8|v<<24)^(_>>>7|v<<25)),I+=x>>>16,B+=65535&(S=(v>>>1|_<<31)^(v>>>8|_<<24)^v>>>7),M+=S>>>16,v=R[(k+14)%16],I+=(x=((_=P[(k+14)%16])>>>19|v<<13)^(v>>>29|_<<3)^(_>>>6|v<<26))>>>16,B+=65535&(S=(v>>>19|_<<13)^(_>>>29|v<<3)^v>>>6),M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,R[k]=65535&B|M<<16,P[k]=65535&A|I<<16;A=65535&(x=j),I=x>>>16,B=65535&(S=T),M=S>>>16,S=t[0],I+=(x=e[0])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[0]=T=65535&B|M<<16,e[0]=j=65535&A|I<<16,A=65535&(x=W),I=x>>>16,B=65535&(S=O),M=S>>>16,S=t[1],I+=(x=e[1])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[1]=O=65535&B|M<<16,e[1]=W=65535&A|I<<16,A=65535&(x=F),I=x>>>16,B=65535&(S=L),M=S>>>16,S=t[2],I+=(x=e[2])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[2]=L=65535&B|M<<16,e[2]=F=65535&A|I<<16,A=65535&(x=K),I=x>>>16,B=65535&(S=U),M=S>>>16,S=t[3],I+=(x=e[3])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[3]=U=65535&B|M<<16,e[3]=K=65535&A|I<<16,A=65535&(x=V),I=x>>>16,B=65535&(S=C),M=S>>>16,S=t[4],I+=(x=e[4])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[4]=C=65535&B|M<<16,e[4]=V=65535&A|I<<16,A=65535&(x=q),I=x>>>16,B=65535&(S=N),M=S>>>16,S=t[5],I+=(x=e[5])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[5]=N=65535&B|M<<16,e[5]=q=65535&A|I<<16,A=65535&(x=H),I=x>>>16,B=65535&(S=z),M=S>>>16,S=t[6],I+=(x=e[6])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[6]=z=65535&B|M<<16,e[6]=H=65535&A|I<<16,A=65535&(x=$),I=x>>>16,B=65535&(S=D),M=S>>>16,S=t[7],I+=(x=e[7])>>>16,B+=65535&S,M+=S>>>16,M+=(B+=(I+=(A+=65535&x)>>>16)>>>16)>>>16,t[7]=D=65535&B|M<<16,e[7]=$=65535&A|I<<16,Z+=128,n-=128}return n}function Y(t,e,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,Z(i,o,e,r),r%=128,n=0;n<r;n++)s[n]=e[a-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,d(s,r-8,a/536870912|0,a<<3),Z(i,o,s,r),n=0;n<8;n++)d(t,8*n,i[n],o[n]);return 0}function J(t,r){var n=e(),i=e(),o=e(),s=e(),a=e(),u=e(),h=e(),l=e(),f=e();N(n,t[1],t[0]),N(f,r[1],r[0]),z(n,n,f),C(i,t[0],t[1]),C(f,r[0],r[1]),z(i,i,f),z(o,t[3],r[3]),z(o,o,c),z(s,t[2],r[2]),C(s,s,s),N(a,i,n),N(u,s,o),C(h,s,o),C(l,i,n),z(t[0],a,u),z(t[1],l,h),z(t[2],h,u),z(t[3],a,l)}function X(t,e,r){var n;for(n=0;n<4;n++)P(t[n],e[n],r)}function Q(t,r){var n=e(),i=e(),o=e();j(o,r[2]),z(n,r[0],o),z(i,r[1],o),T(t,i),t[31]^=L(n)<<7}function tt(t,e,r){var n,i;for(M(t[0],o),M(t[1],s),M(t[2],s),M(t[3],o),i=255;i>=0;--i)X(t,e,n=r[i/8|0]>>(7&i)&1),J(e,t),J(t,t),X(t,e,n)}function et(t,r){var n=[e(),e(),e(),e()];M(n[0],h),M(n[1],l),M(n[2],s),z(n[3],h,l),tt(t,n,r)}function rt(t,n,i){var o,s=new Uint8Array(64),a=[e(),e(),e(),e()];for(i||r(n,32),Y(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,et(a,s),Q(t,a),o=0;o<32;o++)n[o+32]=t[o];return 0}var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(t,e){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)e[i]+=r-16*e[n]*nt[i-(n-32)],r=Math.floor((e[i]+128)/256),e[i]-=256*r;e[i]+=r,e[n]=0}for(r=0,i=0;i<32;i++)e[i]+=r-(e[31]>>4)*nt[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*nt[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function ot(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;it(t,r)}function st(t,r,n,i){var o,s,a=new Uint8Array(64),u=new Uint8Array(64),c=new Uint8Array(64),h=new Float64Array(64),l=[e(),e(),e(),e()];Y(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(o=0;o<n;o++)t[64+o]=r[o];for(o=0;o<32;o++)t[32+o]=a[32+o];for(Y(c,t.subarray(32),n+32),ot(c),et(l,c),Q(t,l),o=32;o<64;o++)t[o]=i[o];for(Y(u,t,n+64),ot(u),o=0;o<64;o++)h[o]=0;for(o=0;o<32;o++)h[o]=c[o];for(o=0;o<32;o++)for(s=0;s<32;s++)h[o+s]+=u[o]*a[s];return it(t.subarray(32),h),f}function at(t,r,n,i){var a,c=new Uint8Array(32),h=new Uint8Array(64),l=[e(),e(),e(),e()],d=[e(),e(),e(),e()];if(n<64)return-1;if(function(t,r){var n=e(),i=e(),a=e(),c=e(),h=e(),l=e(),d=e();return M(t[2],s),U(t[1],r),D(a,t[1]),z(c,a,u),N(a,a,t[2]),C(c,t[2],c),D(h,c),D(l,h),z(d,l,h),z(n,d,a),z(n,n,c),W(n,n),z(n,n,a),z(n,n,c),z(n,n,c),z(t[0],n,c),D(i,t[0]),z(i,i,c),O(i,a)&&z(t[0],t[0],f),D(i,t[0]),z(i,i,c),O(i,a)?-1:(L(t[0])===r[31]>>7&&N(t[0],o,t[0]),z(t[3],t[0],t[1]),0)}(d,i))return-1;for(a=0;a<n;a++)t[a]=r[a];for(a=0;a<32;a++)t[a+32]=i[a];if(Y(h,t,n),ot(h),tt(l,d,h),et(d,r.subarray(32)),J(l,d),Q(c,l),n-=64,g(r,0,c,0)){for(a=0;a<n;a++)t[a]=0;return-1}for(a=0;a<n;a++)t[a]=r[a+64];return n}var ut=16,ct=64,ht=32,lt=64;function ft(t,e){if(32!==t.length)throw new Error("bad key size");if(24!==e.length)throw new Error("bad nonce size")}function dt(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function pt(t){for(var e=0;e<t.length;e++)t[e]=0}t.lowlevel={crypto_core_hsalsa20:w,crypto_stream_xor:k,crypto_stream:E,crypto_stream_salsa20_xor:v,crypto_stream_salsa20:_,crypto_onetimeauth:x,crypto_onetimeauth_verify:A,crypto_verify_16:y,crypto_verify_32:g,crypto_secretbox:I,crypto_secretbox_open:B,crypto_scalarmult:F,crypto_scalarmult_base:K,crypto_box_beforenm:q,crypto_box_afternm:H,crypto_box:function(t,e,r,n,i,o){var s=new Uint8Array(32);return q(s,i,o),H(t,e,r,n,s)},crypto_box_open:function(t,e,r,n,i,o){var s=new Uint8Array(32);return q(s,i,o),$(t,e,r,n,s)},crypto_box_keypair:V,crypto_hash:Y,crypto_sign:st,crypto_sign_keypair:rt,crypto_sign_open:at,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ut,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:ct,crypto_sign_PUBLICKEYBYTES:ht,crypto_sign_SECRETKEYBYTES:lt,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:e,D:u,L:nt,pack25519:T,unpack25519:U,M:z,A:C,S:D,Z:N,pow2523:W,add:J,set25519:M,modL:it,scalarmult:tt,scalarbase:et},t.randomBytes=function(t){var e=new Uint8Array(t);return r(e,t),e},t.secretbox=function(t,e,r){dt(t,e,r),ft(r,e);for(var n=new Uint8Array(32+t.length),i=new Uint8Array(n.length),o=0;o<t.length;o++)n[o+32]=t[o];return I(i,n,n.length,e,r),i.subarray(ut)},t.secretbox.open=function(t,e,r){dt(t,e,r),ft(r,e);for(var n=new Uint8Array(ut+t.length),i=new Uint8Array(n.length),o=0;o<t.length;o++)n[o+ut]=t[o];return n.length<32||0!==B(i,n,n.length,e,r)?null:i.subarray(32)},t.secretbox.keyLength=32,t.secretbox.nonceLength=24,t.secretbox.overheadLength=ut,t.scalarMult=function(t,e){if(dt(t,e),32!==t.length)throw new Error("bad n size");if(32!==e.length)throw new Error("bad p size");var r=new Uint8Array(32);return F(r,t,e),r},t.scalarMult.base=function(t){if(dt(t),32!==t.length)throw new Error("bad n size");var e=new Uint8Array(32);return K(e,t),e},t.scalarMult.scalarLength=32,t.scalarMult.groupElementLength=32,t.box=function(e,r,n,i){var o=t.box.before(n,i);return t.secretbox(e,r,o)},t.box.before=function(t,e){dt(t,e),function(t,e){if(32!==t.length)throw new Error("bad public key size");if(32!==e.length)throw new Error("bad secret key size")}(t,e);var r=new Uint8Array(32);return q(r,t,e),r},t.box.after=t.secretbox,t.box.open=function(e,r,n,i){var o=t.box.before(n,i);return t.secretbox.open(e,r,o)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(32);return V(t,e),{publicKey:t,secretKey:e}},t.box.keyPair.fromSecretKey=function(t){if(dt(t),32!==t.length)throw new Error("bad secret key size");var e=new Uint8Array(32);return K(e,t),{publicKey:e,secretKey:new Uint8Array(t)}},t.box.publicKeyLength=32,t.box.secretKeyLength=32,t.box.sharedKeyLength=32,t.box.nonceLength=24,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(t,e){if(dt(t,e),e.length!==lt)throw new Error("bad secret key size");var r=new Uint8Array(ct+t.length);return st(r,t,t.length,e),r},t.sign.open=function(t,e){if(dt(t,e),e.length!==ht)throw new Error("bad public key size");var r=new Uint8Array(t.length),n=at(r,t,t.length,e);if(n<0)return null;for(var i=new Uint8Array(n),o=0;o<i.length;o++)i[o]=r[o];return i},t.sign.detached=function(e,r){for(var n=t.sign(e,r),i=new Uint8Array(ct),o=0;o<i.length;o++)i[o]=n[o];return i},t.sign.detached.verify=function(t,e,r){if(dt(t,e,r),e.length!==ct)throw new Error("bad signature size");if(r.length!==ht)throw new Error("bad public key size");var n,i=new Uint8Array(ct+t.length),o=new Uint8Array(ct+t.length);for(n=0;n<ct;n++)i[n]=e[n];for(n=0;n<t.length;n++)i[n+ct]=t[n];return at(o,i,i.length,r)>=0},t.sign.keyPair=function(){var t=new Uint8Array(ht),e=new Uint8Array(lt);return rt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(dt(t),t.length!==lt)throw new Error("bad secret key size");for(var e=new Uint8Array(ht),r=0;r<e.length;r++)e[r]=t[32+r];return{publicKey:e,secretKey:new Uint8Array(t)}},t.sign.keyPair.fromSeed=function(t){if(dt(t),32!==t.length)throw new Error("bad seed size");for(var e=new Uint8Array(ht),r=new Uint8Array(lt),n=0;n<32;n++)r[n]=t[n];return rt(e,r,!0),{publicKey:e,secretKey:r}},t.sign.publicKeyLength=ht,t.sign.secretKeyLength=lt,t.sign.seedLength=32,t.sign.signatureLength=ct,t.hash=function(t){dt(t);var e=new Uint8Array(64);return Y(e,t,t.length),e},t.hash.hashLength=64,t.verify=function(t,e){return dt(t,e),0!==t.length&&0!==e.length&&t.length===e.length&&0===p(t,0,e,0,t.length)},t.setPRNG=function(t){r=t},function(){var e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&e.getRandomValues?t.setPRNG((function(t,r){var n,i=new Uint8Array(r);for(n=0;n<r;n+=65536)e.getRandomValues(i.subarray(n,n+Math.min(r-n,65536)));for(n=0;n<r;n++)t[n]=i[n];pt(i)})):void 0!==dR&&(e=ee)&&e.randomBytes&&t.setPRNG((function(t,r){var n,i=e.randomBytes(r);for(n=0;n<r;n++)t[n]=i[n];pt(i)}))}()}(pR.exports?pR.exports:self.nacl=self.nacl||{});var yR=pR.exports;const gR=(t,e,r)=>yR.sign.detached.verify(t,e,r.toBytes()),mR=(t,e)=>{const{pubkey:r}=SM(e+"."+t,exports.RecordVersion.V1);return r};async function wR(t,e,r,n){const i=mR(e,r);let{registry:o}=await oh.retrieve(t,i);if(!o.data)throw new Dc(exports.ErrorType.NoRecordData);if(n)return vR(o,r,i);const s=xB.get(r);return o.data=o.data.slice(0,s),o}const bR=async(t,e)=>await wR(t,e,exports.Record.SOL),vR=(t,e,r)=>{const i=null==t?void 0:t.data;if(!i)return;if(0===i.compare(n.Buffer.alloc(i.length)))return;const o=xB.get(e),s=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!o)return i.slice(0,s).toString("utf-8");if(e===exports.Record.SOL){const e=new TextEncoder,o=n.Buffer.concat([i.slice(0,32),r.toBuffer()]),s=e.encode(o.toString("hex"));if(gR(s,i.slice(32,96),t.owner))return Uv.encode(i.slice(0,32))}if(o&&s!==o){const t=i.slice(0,s).toString("utf-8");if(e===exports.Record.Injective){const e=qM(t);if("inj"===e.prefix&&20===e.data.length)return t}else if(e===exports.Record.BSC||e===exports.Record.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===n.Buffer.from(r,"hex").length)return t}else if((e===exports.Record.A||e===exports.Record.AAAA)&&nR.isValid(t))return t;throw new Dc(exports.ErrorType.InvalidRecordData)}if(e===exports.Record.ETH||e===exports.Record.BSC)return"0x"+i.slice(0,o).toString("hex");if(e===exports.Record.Injective)return HM("inj",i.slice(0,o),"bech32");if(e===exports.Record.A||e===exports.Record.AAAA)return nR.fromByteArray([...i.slice(0,o)]).toString();if(e===exports.Record.Background)return new Wo(i.slice(0,o)).toString();throw new Dc(exports.ErrorType.InvalidRecordData)},_R=(t,e)=>{if(!xB.get(e))return e!==exports.Record.CNAME&&e!==exports.Record.TXT||(t=fR(t)),n.Buffer.from(t,"utf-8");if(e===exports.Record.SOL)throw new Dc(exports.ErrorType.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(e===exports.Record.ETH||e===exports.Record.BSC)return BM("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(t.slice(2),"hex");if(e===exports.Record.Injective){const e=qM(t);return BM("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),BM(20===e.data.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(e.data)}if(e===exports.Record.A){const e=nR.parse(t).toByteArray();return BM(4===e.length,exports.ErrorType.InvalidARecord),n.Buffer.from(e)}if(e===exports.Record.AAAA){const e=nR.parse(t).toByteArray();return BM(16===e.length,exports.ErrorType.InvalidAAAARecord),n.Buffer.from(e)}if(e===exports.Record.Background)return new Wo(t).toBuffer();throw new Dc(exports.ErrorType.InvalidRecordInput)},ER=(t,e,r,i)=>{const o=n.Buffer.concat([t.toBuffer(),e.toBuffer()]),s=(new TextEncoder).encode(o.toString("hex")),a=gR(s,i,r);return BM(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([t.toBuffer(),i])},kR=new Map([[exports.Record.Url,new Wo("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),SR=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC]),xR=new Set([exports.Record.IPFS,exports.Record.ARWV,exports.Record.LTC,exports.Record.DOGE,exports.Record.Email,exports.Record.Url,exports.Record.Discord,exports.Record.Github,exports.Record.Reddit,exports.Record.Twitter,exports.Record.Telegram,exports.Record.Pic,exports.Record.SHDW,exports.Record.POINT,exports.Record.Backpack,exports.Record.TXT,exports.Record.CNAME,exports.Record.BTC]),AR=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),IR=(t,e)=>{if(xR.has(e)){const r=t.toString("utf-8");return e===exports.Record.CNAME||e===exports.Record.TXT?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&&cR("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=oR;;i+=oR){u>=r&&cR("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:oR;s>=oR&&cR("invalid-input"),s>aR((iR-n)/e)&&cR("overflow"),n+=s*e;const c=i<=o?1:i>=o+26?26:i-o;if(s<c)break;const h=oR-c;e>aR(iR/h)&&cR("overflow"),e*=h}const c=e.length+1;o=lR(n-s,c,0==s),aR(n/c)>iR-i&&cR("overflow"),i+=aR(n/c),n%=c,e.splice(n++,0,i)}var a;return String.fromCodePoint(...e)}(r):r}if(e===exports.Record.SOL)return new Wo(t).toBase58();if(e===exports.Record.ETH||e===exports.Record.BSC)return"0x"+t.toString("hex");if(e===exports.Record.Injective)return HM("inj",t,"bech32");if(e===exports.Record.A||e===exports.Record.AAAA)return nR.fromByteArray([...t]).toString();throw new Dc(exports.ErrorType.InvalidARecord)},BR=(t,e)=>{if(xR.has(e))return e!==exports.Record.CNAME&&e!==exports.Record.TXT||(t=fR(t)),Buffer.from(t,"utf-8");if(e===exports.Record.SOL)return new Wo(t).toBuffer();if(e===exports.Record.ETH||e===exports.Record.BSC)return BM("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(t.slice(2),"hex");if(e===exports.Record.Injective){const e=qM(t);return BM("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),BM(20===e.data.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(e.data)}if(e===exports.Record.A){const e=nR.parse(t).toByteArray();return BM(4===e.length,exports.ErrorType.InvalidARecord),Buffer.from(e)}if(e===exports.Record.AAAA){const e=nR.parse(t).toByteArray();return BM(16===e.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(e)}throw new Dc(exports.ErrorType.InvalidARecord)},MR=(t,e)=>{const{pubkey:r}=SM(t),n=bM("".concat(e));return vM(n,bB,r)};async function RR(t,e,r,n,i,o,s,a){const u=await Ff(e),c=await Kf(u,s,a),h=o||await t.getMinimumBalanceForRentExemption(r);let l;if(a){const{registry:e}=await Wf(t,a);l=e.owner}return Fc(kf,Os.programId,c,i,n,u,new Wc(h),new jc(r),s,a,l)}async function PR(t,e,r,n,i){const o=await Ff(e),s=await Kf(o,n,i);let a;a=n||(await oh.retrieve(t,s)).registry.owner;return qc(kf,s,r,a)}const TR=async(t,e,r,n,i)=>{let[o]=await Wo.findProgramAddress([Af.toBuffer()],Af),s=await Ff(t.toBase58()),a=await Kf(s,o,n);return[[],[new $c({name:e}).getInstruction(Af,kf,xf,a,Os.programId,o,r,ms,n,i)]]},OR=async(t,e,r,n,i,o)=>{BM(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s,hashed:a,parent:u}=SM(`${r}.${e}`,exports.RecordVersion.V1),c=_R(n,r).length,h=await t.getMinimumBalanceForRentExemption(c+oh.HEADER_LEN);return Fc(kf,Os.programId,s,i,o,a,new Wc(h),new jc(c),void 0,u,i)},LR=async(t,e,r,n,i,o)=>{const{pubkey:s,hashed:a,parent:u}=SM(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),c=ER(r,s,n,i).length,h=await t.getMinimumBalanceForRentExemption(c+oh.HEADER_LEN);return[Fc(kf,Os.programId,s,n,o,a,new Wc(h),new jc(c),void 0,u,n)]};class UR{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 Dc(exports.ErrorType.InvalidReverseTwitter);return Oe(this.schema,UR,r.data.slice(oh.HEADER_LEN))}}async function CR(t,e,r,i,o){const s=await Ff(i.toString()),a=await Kf(s,Rf,Pf);let u=He(UR.schema,new UR({twitterRegistryKey:r.toBytes(),twitterHandle:e}));return[Fc(kf,Os.programId,a,i,o,s,new Wc(await t.getMinimumBalanceForRentExemption(u.length+oh.HEADER_LEN)),new jc(u.length),Rf,Pf,Rf),Kc(kf,a,new jc(0),n.Buffer.from(u),Rf)]}UR.schema=new Map([[UR,{kind:"struct",fields:[["twitterRegistryKey",[32]],["twitterHandle","string"]]}]]);const NR=async(t,e)=>{const{pubkey:r}=SM(e),{registry:n,nftOwner:i}=await oh.retrieve(t,r);if(i)return i;try{const r=await DR(t,n.owner,e);if(void 0!==r)return r;return await zR(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},zR=async(t,e,r)=>{const i=mR(r,exports.Record.SOL),o=await bR(t,r);if(!(null==o?void 0:o.data))throw new Dc(exports.ErrorType.NoRecordData);const s=new TextEncoder,a=n.Buffer.concat([o.data.slice(0,32),i.toBuffer()]),u=s.encode(a.toString("hex"));if(!gR(u,o.data.slice(32),e))throw new Dc(exports.ErrorType.InvalidSignature);return new Wo(o.data.slice(0,32))},DR=async(t,e,r)=>{try{const n=MR(r,exports.Record.SOL),i=await kB.retrieve(t,n),o=i.getStalenessId(),s=i.getRoAId(),a=i.getContent();if(0===o.compare(e.toBuffer())&&i.header.stalenessValidation===vB.Solana&&0===s.compare(a)&&i.header.rightOfAssociationValidation===vB.Solana)return new Wo(a)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},jR=new Wo("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class WR{constructor(t){this.tag=t.tag,this.nameAccount=new Wo(t.nameAccount)}static deserialize(t){return Ze(this.schema,WR,t)}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Dc(exports.ErrorType.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(t,e){return await Wo.findProgramAddress([n.Buffer.from("favourite_domain"),e.toBuffer()],t)}static getKeySync(t,e){return Wo.findProgramAddressSync([n.Buffer.from("favourite_domain"),e.toBuffer()],t)}}WR.schema=new Map([[WR,{kind:"struct",fields:[["tag","u8"],["nameAccount",[32]]]}]]);var FR;exports.CustomBg=void 0,(FR=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",FR.Rgb0x001="rgb0x00#1";const KR=new Wo("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),VR=new Wo("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),qR={NAME_PROGRAM_ID:new Wo("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new Wo("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new Wo("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new Wo("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new Wo("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new Wo("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1")],TOKENS_SYM_MINT:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU","USDC"],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS","USDT"],["So11111111111111111111111111111111111111112","SOL"],["fidaWCioBQjieRrUQDxxS5Uxmq1CLi2VuVRyv4dEBey","FIDA"],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P","INJ"]]),PYTH_MAPPING_ACC:new Wo("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new Wo("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},HR=(t,e,r)=>{const i=[t];e?i.push(e.toBuffer()):i.push(n.Buffer.alloc(32)),r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32));const[o]=Wo.findProgramAddressSync(i,qR.NAME_PROGRAM_ID);return o},$R=(t,e=qR.ROOT_DOMAIN_ACCOUNT,r)=>{let n=bM(t);return{pubkey:HR(n,r,e),hashed:n}},GR=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}=$R(e[1]);return{...$R(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new Dc(exports.ErrorType.InvalidInput);return{...$R(t,qR.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ZR=(t,e)=>{const{pubkey:r,parent:n}=GR(t),i=bM(r.toBase58());return HR(i,qR.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function YR(t,e,r,n,i,o,s,a){const u=await Ff(e),c=await HR(u,s,a),h=o||await t.getMinimumBalanceForRentExemption(r);let l;if(a){const{registry:e}=await Wf(t,a);l=e.owner}return Fc(qR.NAME_PROGRAM_ID,Os.programId,c,i,n,u,new Wc(h),new jc(r),s,a,l)}const JR=async(t,e,r,n,i)=>{let[o]=await Wo.findProgramAddress([qR.REGISTER_PROGRAM_ID.toBuffer()],qR.REGISTER_PROGRAM_ID),s=await Ff(t.toBase58()),a=HR(s,o,n);return[[],[new $c({name:e}).getInstruction(qR.REGISTER_PROGRAM_ID,qR.NAME_PROGRAM_ID,qR.ROOT_DOMAIN_ACCOUNT,a,Os.programId,o,r,ms,n,i)]]},XR={utils:{getNameAccountKeySync:HR,reverseLookup:async(t,e)=>{const r=bM(e.toBase58()),n=HR(r,qR.REVERSE_LOOKUP_CLASS),{registry:i}=await oh.retrieve(t,n);if(!i.data)throw new Dc(exports.ErrorType.NoAccountData);const o=new re.BN(i.data.slice(0,4),"le").toNumber();return i.data.slice(4,4+o).toString()},_deriveSync:$R,getDomainKeySync:GR,getReverseKeySync:ZR},constants:qR,bindings:{createNameRegistry:YR,updateNameRegistryData:async function(t,e,r,n,i,o){const s=await Ff(e),a=HR(s,i,o);let u;return u=i||(await oh.retrieve(t,a)).registry.owner,Kc(qR.NAME_PROGRAM_ID,a,new jc(r),n,u)},transferNameOwnership:async function(t,e,r,n,i,o){const s=await Ff(e),a=HR(s,n,i);let u;return u=n||(await oh.retrieve(t,a)).registry.owner,Vc(qR.NAME_PROGRAM_ID,a,r,u,n,i,o)},deleteNameRegistry:async function(t,e,r,n,i){const o=await Ff(e),s=HR(o,n,i);let a;return a=n||(await oh.retrieve(t,s)).registry.owner,qc(qR.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(t,e,r,n,i,o=qR.USDC_MINT,s)=>{if(e.includes(".")||e.trim().toLowerCase()!==e)throw new Dc(exports.ErrorType.InvalidDomain);const[a]=Wo.findProgramAddressSync([qR.REGISTER_PROGRAM_ID.toBuffer()],qR.REGISTER_PROGRAM_ID),u=bM(e),c=HR(u,void 0,qR.ROOT_DOMAIN_ACCOUNT),h=bM(c.toBase58()),l=HR(h,a),[f]=Wo.findProgramAddressSync([c.toBuffer()],qR.REGISTER_PROGRAM_ID),d=qR.REFERRERS.findIndex((t=>null==s?void 0:s.equals(t)));let p;const y=[];if(-1!==d&&s){p=Cc(o,s,!0);const e=await t.getAccountInfo(p);if(!(null==e?void 0:e.data)){const t=Nc(n,p,s,o);y.push(t)}}const g=new Yv.PythHttpClient(t,Yv.getPythProgramKeyForCluster("devnet")),m=await g.getData(),w=qR.TOKENS_SYM_MINT.get(o.toBase58());if(!w)throw new Dc(exports.ErrorType.SymbolNotFound,`No symbol found for mint ${o.toBase58()}`);const b=m.productPrice.get("Crypto."+w+"/USD"),v=m.productFromSymbol.get("Crypto."+w+"/USD"),_=Cc(o,qR.VAULT_OWNER),E=new Gc({name:e,space:r,referrerIdxOpt:-1!=d?d:null}).getInstruction(qR.REGISTER_PROGRAM_ID,qR.NAME_PROGRAM_ID,qR.ROOT_DOMAIN_ACCOUNT,c,l,Os.programId,a,n,i,qR.PYTH_MAPPING_ACC,b.productAccountKey,new Wo(v.price_account),_,yc,ms,f,p);return y.push(E),[[],y]},createReverseName:JR,createSubdomain:async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Dc(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=GR(e),u=await t.getMinimumBalanceForRentExemption(n+oh.HEADER_LEN),c=await YR(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const h=ZR(e,!0),l=await t.getAccountInfo(h);if(!(null==l?void 0:l.data)){const[,t]=await JR(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},burnDomain:(t,e,r)=>{const{pubkey:n}=GR(t),[i]=Wo.findProgramAddressSync([n.toBuffer()],qR.REGISTER_PROGRAM_ID),[o]=Wo.findProgramAddressSync([n.toBuffer(),Uint8Array.from([1,1])],qR.REGISTER_PROGRAM_ID);return(new Yc).getInstruction(qR.REGISTER_PROGRAM_ID,qR.NAME_PROGRAM_ID,Os.programId,n,ZR(t),o,i,qR.REVERSE_LOOKUP_CLASS,e,r)},transferSubdomain:async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=GR(e);if(!a||!s)throw new Dc(exports.ErrorType.InvalidSubdomain);if(!i){const{registry:e}=await oh.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await oh.retrieve(t,a)).registry.owner);return Vc(qR.NAME_PROGRAM_ID,o,r,i,void 0,u,c)}}};exports.BONFIDA_FIDA_BNB=Bf,exports.BONFIDA_USDC_BNB=Tf,exports.CUSTOM_BG_TLD=zf,exports.ETH_ROA_RECORDS=SR,exports.FavouriteDomain=WR,exports.GUARDIANS=kR,exports.HASH_PREFIX=Sf,exports.METAPLEX_ID=jf,exports.NAME_OFFERS_ID=jR,exports.NAME_PROGRAM_ID=kf,exports.NameRegistryState=oh,exports.Numberu32=jc,exports.Numberu64=Wc,exports.PYTH_FIDA_PRICE_ACC=If,exports.PYTH_MAPPING_ACC=Cf,exports.RECORD_V1_SIZE=xB,exports.REFERRERS=Lf,exports.REGISTER_PROGRAM_ID=Af,exports.REVERSE_LOOKUP_CLASS=Mf,exports.ROOT_DOMAIN_ACCOUNT=xf,exports.ReverseTwitterRegistryState=UR,exports.SELF_SIGNED=AR,exports.SNSError=Dc,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=Uf,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=Pf,exports.TWITTER_VERIFICATION_AUTHORITY=Rf,exports.USDC_MINT=Of,exports.UTF8_ENCODED=xR,exports.VAULT_OWNER=Nf,exports.WOLVES_COLLECTION_METADATA=Df,exports.burnDomain=(t,e,r)=>{const{pubkey:n}=SM(t),[i]=Wo.findProgramAddressSync([n.toBuffer()],Af),[o]=Wo.findProgramAddressSync([n.toBuffer(),Uint8Array.from([1,1])],Af);return(new Yc).getInstruction(Af,kf,Os.programId,n,AM(t),o,i,Mf,e,r)},exports.burnInstruction=Yc,exports.changeTwitterRegistryData=async function(t,e,r,n){const i=await Ff(t),o=await Kf(i,void 0,Pf);return[Kc(kf,o,new jc(r),n,e)]},exports.changeVerifiedPubkey=async function(t,e,r,n,i){const o=await Ff(e),s=await Kf(o,void 0,Pf);let a=[Vc(kf,s,n,r,void 0)];const u=await Ff(r.toString());return await Kf(u,Rf,void 0),a.push(await PR(t,r.toString(),i,Rf,Pf)),a=a.concat(await CR(t,e,s,n,i)),a},exports.check=BM,exports.checkSolRecord=gR,exports.createInstruction=Fc,exports.createInstructionV3=Gc,exports.createNameRegistry=RR,exports.createRecordInstruction=OR,exports.createRecordV2Instruction=(t,e,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(a&&(s=SM(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,e,r,n,i,o,s,a)=>new fB({record:o,content:Array.from(s)}).getInstruction(a,sI.programId,i,t,e,r,n,bB))(i,o,s,n,kf,"".concat(e),BR(r,e),wB);return u},exports.createReverseInstruction=$c,exports.createReverseName=TR,exports.createReverseTwitterRegistry=CR,exports.createSolRecordInstruction=LR,exports.createSubdomain=async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Dc(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=SM(e),u=await t.getMinimumBalanceForRentExemption(n+oh.HEADER_LEN),c=await RR(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const h=AM(e,!0),l=await t.getAccountInfo(h);if(!(null==l?void 0:l.data)){const[,t]=await TR(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},exports.createV2Instruction=Hc,exports.createVerifiedTwitterRegistry=async function(t,e,r,n,i){const o=await Ff(e),s=await Kf(o,void 0,Pf),a=await t.getMinimumBalanceForRentExemption(n+oh.HEADER_LEN);let u=[Fc(kf,Os.programId,s,r,i,o,new Wc(a),new jc(n),void 0,Pf,Rf)];return u=u.concat(await CR(t,e,s,r,i)),u},exports.createWithNftInstruction=Zc,exports.deleteInstruction=qc,exports.deleteNameRegistry=PR,exports.deleteRecordV2=(t,e,r,n)=>{let{pubkey:i,parent:o,isSub:s}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(s&&(o=SM(t).pubkey),!o)throw new Error("Invalid parent");const a=((t,e,r,n,i,o)=>(new gB).getInstruction(o,sI.programId,i,t,n,e,r,bB))(n,o,r,i,kf,wB);return a},exports.deleteTwitterRegistry=async function(t,e){const r=await Ff(t),n=await Kf(r,void 0,Pf),i=await Ff(e.toString()),o=await Kf(i,Rf,Pf);return[qc(kf,n,e,e),qc(kf,o,e,e)]},exports.deserializeRecord=vR,exports.deserializeRecordV2Content=IR,exports.deserializeReverse=MM,exports.devnet=XR,exports.ethValidateRecordV2Content=(t,e,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(u&&(a=SM(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,e,r,n,i,o,s,a,u)=>new dB({validation:o,signature:Array.from(s),expectedPubkey:Array.from(a)}).getInstruction(u,sI.programId,i,t,e,r,n,bB))(n,s,a,r,kf,vB.Ethereum,i,o,wB);return c},exports.findSubdomains=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Mf.toBase58()}}],n=await t.getProgramAccounts(kf,{filters:r}),i=[{memcmp:{offset:0,bytes:e.toBase58()}}],o=await t.getProgramAccounts(kf,{filters:i,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),MM(t.account.data.slice(96))]))),a=[];return o.forEach((t=>{const r=IM(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=xM,exports.getAllRegisteredDomains=async t=>{const e=[{memcmp:{offset:0,bytes:xf.toBase58()}}];return await t.getProgramAccounts(kf,{dataSlice:{offset:32,length:32},filters:e})},exports.getArtistPubkey=t=>{switch(t){case exports.CustomBg.DegenPoet1:return KR;case exports.CustomBg.Rgb0x001:return VR;default:throw new Dc(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(t,e)=>await wR(t,e,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(t,e)=>await wR(t,e,exports.Record.Background,!0),exports.getBackpackRecord=async(t,e)=>await wR(t,e,exports.Record.Backpack,!0),exports.getBscRecord=async(t,e)=>await wR(t,e,exports.Record.BSC,!0),exports.getBtcRecord=async(t,e)=>await wR(t,e,exports.Record.BTC,!0),exports.getCustomBgKeys=(t,e)=>{const r=bM(e),n=bM(t),i=vM(n,void 0,zf);return{domainKey:i,bgKey:vM(r,void 0,i)}},exports.getDiscordRecord=async(t,e)=>await wR(t,e,exports.Record.Discord,!0),exports.getDogeRecord=async(t,e)=>await wR(t,e,exports.Record.DOGE,!0),exports.getDomainKey=qf,exports.getDomainKeySync=SM,exports.getDomainKeysWithReverses=async function(t,e){const r=await xM(t,e),n=await EM(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))},exports.getDomainPriceFromName=t=>{switch(wM(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}},exports.getEmailRecord=async(t,e)=>await wR(t,e,exports.Record.Email,!0),exports.getEthRecord=async(t,e)=>await wR(t,e,exports.Record.ETH,!0),exports.getFavoriteDomain=async(t,e)=>{const[r]=WR.getKeySync(jR,new Wo(e)),n=await WR.retrieve(t,r),i=await _M(t,n.nameAccount),o=await NR(t,i);return{domain:n.nameAccount,reverse:i,stale:!e.equals(o)}},exports.getGithubRecord=async(t,e)=>await wR(t,e,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(t,e){const r=await Ff(e.toString()),n=await Kf(r,Rf,Pf);let i=await UR.retrieve(t,n);return[i.twitterHandle,new Wo(i.twitterRegistryKey)]},exports.getHashedName=Ff,exports.getHashedNameSync=bM,exports.getInjectiveRecord=async(t,e)=>await wR(t,e,exports.Record.Injective,!0),exports.getIpfsRecord=async(t,e)=>await wR(t,e,exports.Record.IPFS,!0),exports.getLtcRecord=async(t,e)=>await wR(t,e,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(t,e)=>{const r=[],n=e.map((t=>WR.getKeySync(jR,t)[0])),i=(await t.getMultipleAccountsInfo(n)).map((t=>(null==t?void 0:t.data)?WR.deserialize(null==t?void 0:t.data).nameAccount:Wo.default)),o=i.map((t=>IM(t))),s=i.map(((t,r)=>Cc((t=>{const[e]=Wo.findProgramAddressSync([Xc,t.toBuffer()],Jc);return e})(t),e[r],!0))),[a,u,c]=await Promise.all([t.getMultipleAccountsInfo(i),t.getMultipleAccountsInfo(o),t.getMultipleAccountsInfo(s)]);for(let t=0;t<e.length;t++){const n=a[t],i=u[t],o=c[t];if(!n||!i){r.push(void 0);continue}if(new Wo(null==n?void 0:n.data.slice(32,64)).equals(e[t])){r.push(MM(null==i?void 0:i.data.slice(96)));continue}if(!o){r.push(void 0);continue}const s=Pc.decode(o.data);1!==Number(s.amount)?r.push(void 0):r.push(MM(null==i?void 0:i.data.slice(96)))}return r},exports.getMultipleRecordsV2=async function(t,e,r,n={}){const i=r.map((t=>MR(e,t))),o=await kB.retrieveBatch(t,i);return n.deserialize?o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:IR(t.getContent(),r[e])}})):o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))},exports.getNameAccountKey=Kf,exports.getNameAccountKeySync=vM,exports.getNameOwner=Wf,exports.getPicRecord=async(t,e)=>await wR(t,e,exports.Record.Pic,!0),exports.getPointRecord=async(t,e)=>await wR(t,e,exports.Record.POINT,!0),exports.getRecord=wR,exports.getRecordKeySync=mR,exports.getRecordV2=async function(t,e,r,n={}){const i=MR(e,r),o=await kB.retrieve(t,i);return n.deserialize?{retrievedRecord:o,deserializedContent:IR(o.getContent(),r)}:{retrievedRecord:o}},exports.getRecordV2Key=MR,exports.getRecords=async function(t,e,r,n){const i=r.map((t=>mR(e,t))),o=await oh.retrieveBatch(t,i);return n?o.map(((t,n)=>{if(t)return vR(t,r[n],mR(e,r[n]))})):o},exports.getRedditRecord=async(t,e)=>await wR(t,e,exports.Record.Reddit,!0),exports.getReverseKey=async(t,e)=>{const{pubkey:r,parent:n}=await qf(t),i=await Ff(r.toBase58());return await Kf(i,Mf,e?n:void 0)},exports.getReverseKeyFromDomainKey=IM,exports.getReverseKeySync=AM,exports.getShdwRecord=async(t,e)=>await wR(t,e,exports.Record.SHDW,!0),exports.getSolRecord=bR,exports.getTelegramRecord=async(t,e)=>await wR(t,e,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(t,e)=>{const r=await ih(t,e),n=await EM(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))},exports.getTwitterHandleandRegistryKeyViaFilters=async function(t,e){const r=[{memcmp:{offset:0,bytes:Pf.toBase58()}},{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Rf.toBase58()}}],n=await t.getProgramAccounts(kf,{filters:r});for(const t of n)if(t.account.data.length>oh.HEADER_LEN+32){let e=t.account.data.slice(oh.HEADER_LEN),r=Oe(UR.schema,UR,e);return[r.twitterHandle,new Wo(r.twitterRegistryKey)]}throw new Dc(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(t,e)=>await wR(t,e,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(t,e){const r=await Ff(e),n=await Kf(r,void 0,Pf),{registry:i}=await oh.retrieve(t,n);return i},exports.getTwitterRegistryData=async function(t,e){const r=[{memcmp:{offset:0,bytes:Pf.toBase58()}},{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:new Wo(n.Buffer.alloc(32,0)).toBase58()}}],i=await t.getProgramAccounts(kf,{filters:r});if(i.length>1)throw new Dc(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(oh.HEADER_LEN)},exports.getTwitterRegistryKey=async function(t){const e=await Ff(t);return await Kf(e,void 0,Pf)},exports.getUrlRecord=async(t,e)=>await wR(t,e,exports.Record.Url,!0),exports.performReverseLookup=async function(t,e){const r=await Ff(e.toBase58()),n=await Kf(r,Mf),{registry:i}=await oh.retrieve(t,n);if(!i.data)throw new Dc(exports.ErrorType.NoAccountData);const o=new ne(i.data.slice(0,4),"le").toNumber();return i.data.slice(4,4+o).toString()},exports.performReverseLookupBatch=async function(t,e){let r=[];for(let t of e){const e=await Ff(t.toBase58()),n=await Kf(e,Mf);r.push(n)}return(await oh.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;let e=new ne(t.data.slice(0,4),"le").toNumber();return t.data.slice(4,4+e).toString()}))},exports.reallocInstruction=function(t,e,r,i,o,s){const a=[n.Buffer.from(Int8Array.from([4])),s.toBuffer()],u=n.Buffer.concat(a);return new cs({keys:[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:u})},exports.registerDomainName=async(t,e,r,n,i,o=Of,s)=>{if(e.includes(".")||e.trim().toLowerCase()!==e)throw new Dc(exports.ErrorType.InvalidDomain);const[a]=Wo.findProgramAddressSync([Af.toBuffer()],Af),u=bM(e),c=vM(u,void 0,xf),h=bM(c.toBase58()),l=vM(h,a),[f]=Wo.findProgramAddressSync([c.toBuffer()],Af),d=Lf.findIndex((t=>null==s?void 0:s.equals(t)));let p;const y=[];if(-1!==d&&s){p=Cc(o,s,!0);const e=await t.getAccountInfo(p);if(!(null==e?void 0:e.data)){const t=Nc(n,p,s,o);y.push(t)}}const g=new Yv.PythHttpClient(t,Yv.getPythProgramKeyForCluster("mainnet-beta")),m=await g.getData(),w=Uf.get(o.toBase58());if(!w)throw new Dc(exports.ErrorType.SymbolNotFound,`No symbol found for mint ${o.toBase58()}`);const b=m.productPrice.get("Crypto."+w+"/USD"),v=m.productFromSymbol.get("Crypto."+w+"/USD"),_=Cc(o,Nf),E=new Gc({name:e,space:r,referrerIdxOpt:-1!=d?d:null}).getInstruction(Af,kf,xf,c,l,Os.programId,a,n,i,Cf,b.productAccountKey,new Wo(v.price_account),_,yc,ms,f,p);return y.push(E),[[],y]},exports.registerWithNft=(t,e,r,n,i,o,s,a,u)=>{const[c]=Wo.findProgramAddressSync([r.toBuffer()],Af);return new Zc({space:e,name:t}).getInstruction(Af,kf,xf,r,n,Os.programId,Mf,i,o,s,a,u,Df,yc,ms,c,jf)},exports.resolve=NR,exports.retrieveNftOwner=eh,exports.retrieveNfts=async t=>{const e=await t.getProgramAccounts(Jc,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return e.map((t=>new Wo(t.account.data.slice(66,98))))},exports.retrieveRecords=ih,exports.reverseLookup=_M,exports.reverseLookupBatch=EM,exports.serializeRecord=_R,exports.serializeRecordV2Content=BR,exports.serializeSolRecord=ER,exports.transferInstruction=Vc,exports.transferNameOwnership=async function(t,e,r,n,i,o){const s=await Ff(e),a=await Kf(s,n,i);let u;return u=n||(await oh.retrieve(t,a)).registry.owner,Vc(kf,a,r,u,n,i,o)},exports.transferSubdomain=async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=SM(e);if(!a||!s)throw new Dc(exports.ErrorType.InvalidSubdomain);if(!i){const{registry:e}=await oh.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await oh.retrieve(t,a)).registry.owner);return Vc(kf,o,r,i,void 0,u,c)},exports.updateInstruction=Kc,exports.updateNameRegistryData=async function(t,e,r,n,i,o){const s=await Ff(e),a=await Kf(s,i,o);let u;return u=i||(await oh.retrieve(t,a)).registry.owner,Kc(kf,a,new jc(r),n,u)},exports.updateRecordInstruction=async(t,e,r,n,i,o)=>{BM(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=SM(`${r}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);BM(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const u=_R(n,r);if((null==a?void 0:a.data.slice(96).length)!==u.length)return[qc(kf,s,o,i),await OR(t,e,r,n,i,o)];return[Kc(kf,s,new jc(0),u,i)]},exports.updateRecordV2Instruction=(t,e,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(a&&(s=SM(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,e,r,n,i,o,s,a)=>new yB({record:o,content:Array.from(s)}).getInstruction(a,sI.programId,i,t,e,r,n,bB))(i,o,s,n,kf,"".concat(e),BR(r,e),wB);return u},exports.updateSolRecordInstruction=async(t,e,r,n,i,o)=>{const{pubkey:s}=SM(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);if(BM(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[qc(kf,s,o,n),await LR(t,e,r,n,i,o)];const u=ER(r,s,n,i);return[Kc(kf,s,new jc(0),u,n)]},exports.validateRecordV2Content=(t,e,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=SM(`${r}.${e}`,exports.RecordVersion.V2);if(u&&(a=SM(e).pubkey),!a)throw new Error("Invalid parent");const c=((t,e,r,n,i,o,s,a)=>new pB({staleness:s}).getInstruction(a,sI.programId,o,t,e,r,n,bB,i))(i,s,a,n,o,kf,t,wB);return c},exports.verifyRightOfAssociation=async(t,e,r,n)=>{var i;const o=MR(r,e),s=await kB.retrieve(t,o),a=s.getRoAId(),u=SR.has(e)?vB.Ethereum:vB.Solana;if(!(n=null!=n?n:null===(i=kR.get(e))||void 0===i?void 0:i.toBuffer()))throw new Dc(exports.ErrorType.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===u},exports.verifyStaleness=async(t,e,r)=>{const n=MR(r,e),i=await NR(t,r),o=await kB.retrieve(t,n),s=o.getStalenessId();return i.equals(new Wo(s))&&o.header.stalenessValidation===vB.Solana},exports.writRoaRecordV2=(t,e,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=SM(`${e}.${t}`,exports.RecordVersion.V2);if(a&&(s=SM(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,e,r,n,i,o,s)=>new mB({roaId:Array.from(o.toBuffer())}).getInstruction(s,sI.programId,e,t,r,n,i,bB))(n,kf,o,s,r,i,wB);return u};
45
45
  //# sourceMappingURL=index.cjs.map