@clerk/ui 1.0.0-snapshot.v20251218183643 → 1.0.0-snapshot.v20260105214115
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/207_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/217_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/360_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/444_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/573_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/970_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/ClerkUi.js +2 -2
- package/dist/apiKeys_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/blankcaptcha_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/{checkout_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → checkout_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +1 -1
- package/dist/checkout_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/components/Checkout/CheckoutPage.js +1 -1
- package/dist/components/Checkout/CheckoutPage.js.map +1 -1
- package/dist/components/Checkout/parts.js +1 -1
- package/dist/components/Checkout/parts.js.map +1 -1
- package/dist/components/OrganizationList/UserMembershipList.js +1 -1
- package/dist/components/OrganizationList/UserMembershipList.js.map +1 -1
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherPopover.js +1 -1
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherPopover.js.map +1 -1
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherTrigger.js +1 -1
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherTrigger.js.map +1 -1
- package/dist/components/OrganizationSwitcher/UserMembershipList.js +1 -1
- package/dist/components/OrganizationSwitcher/UserMembershipList.js.map +1 -1
- package/dist/components/SignIn/index.js +1 -1
- package/dist/components/SignIn/index.js.map +1 -1
- package/dist/components/SignUp/index.js +1 -1
- package/dist/components/SignUp/index.js.map +1 -1
- package/dist/components/UserProfile/Web3Form.js +32 -45
- package/dist/components/UserProfile/Web3Form.js.map +1 -1
- package/dist/components/UserProfile/Web3Section.js +6 -3
- package/dist/components/UserProfile/Web3Section.js.map +1 -1
- package/dist/copy-api-key-modal_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/createorganization_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/enableOrganizationsPrompt_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/framework_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/impersonationfab_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/index.js +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/keylessPrompt_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/oauthConsent_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/onetap_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/op-api-keys-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/op-billing-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/op-plans-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/organizationlist_ui_bd1c40_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/organizationlist_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/organizationprofile_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/organizationswitcher_ui_bd1c40_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/organizationswitcher_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/payment-attempt-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/planDetails_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/prefetchorganizationlist_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/pricingTable_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/revoke-api-key-modal_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/sessionTasks_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/{signin_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → signin_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +1 -1
- package/dist/signin_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/{signup_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → signup_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +1 -1
- package/dist/signup_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/statement-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/subscriptionDetails_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/taskChooseOrganization_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/taskResetPassword_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/{ui-common_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → ui-common_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +7 -7
- package/dist/ui-common_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/ui.browser.js +1 -1
- package/dist/ui.legacy.browser.js +1 -0
- package/dist/up-api-keys-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/up-billing-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/up-plans-page_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/useravatar_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/userbutton_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/{userprofile_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → userprofile_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +2 -2
- package/dist/userprofile_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/userverification_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/utils/errorHandler.js +1 -7
- package/dist/utils/errorHandler.js.map +1 -1
- package/dist/{vendors_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → vendors_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +1 -1
- package/dist/vendors_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/waitlist_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/dist/{web3-solana-wallet-buttons_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → web3-solana-wallet-buttons_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +3 -3
- package/dist/web3-solana-wallet-buttons_ui_dd6371_1.0.0-snapshot.v20260105214115.js +1 -0
- package/package.json +8 -5
- package/dist/organizationlist_ui_b31bc8_1.0.0-snapshot.v20251218183643.js +0 -1
- package/dist/organizationswitcher_ui_b31bc8_1.0.0-snapshot.v20251218183643.js +0 -1
- /package/dist/{207_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 207_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{217_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 217_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{360_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 360_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{444_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 444_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{573_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 573_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{970_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 970_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{apiKeys_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → apiKeys_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{blankcaptcha_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → blankcaptcha_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{copy-api-key-modal_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → copy-api-key-modal_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{createorganization_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → createorganization_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{enableOrganizationsPrompt_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → enableOrganizationsPrompt_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{framework_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → framework_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{impersonationfab_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → impersonationfab_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{keylessPrompt_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → keylessPrompt_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{oauthConsent_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → oauthConsent_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{onetap_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → onetap_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{op-api-keys-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → op-api-keys-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{op-billing-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → op-billing-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{op-plans-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → op-plans-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{organizationprofile_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → organizationprofile_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{payment-attempt-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → payment-attempt-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{planDetails_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → planDetails_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{prefetchorganizationlist_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → prefetchorganizationlist_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{pricingTable_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → pricingTable_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{revoke-api-key-modal_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → revoke-api-key-modal_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{sessionTasks_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → sessionTasks_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{statement-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → statement-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{subscriptionDetails_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → subscriptionDetails_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{taskChooseOrganization_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → taskChooseOrganization_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{taskResetPassword_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → taskResetPassword_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{up-api-keys-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → up-api-keys-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{up-billing-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → up-billing-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{up-plans-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → up-plans-page_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{useravatar_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → useravatar_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{userbutton_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → userbutton_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{userverification_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → userverification_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
- /package/dist/{waitlist_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → waitlist_ui_bd1c40_1.0.0-snapshot.v20260105214115.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["188"],{5916:function(t,e,r){"use strict";e.nu64=e.u32=e.u16=e.u8=e.offset=void 0,e.blob=e.seq=e.struct=e.ns64=void 0;let i=r(6826);function n(t){if(!(t instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(t){return n(t),i.Buffer.from(t.buffer,t.byteOffset,t.length)}class o{constructor(t,e){if(!Number.isInteger(t))throw TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function a(t,e){return e.property?t+"["+e.property+"]":t}class u extends o{isCount(){throw Error("ExternalLayout is abstract")}}class l extends u{constructor(t,e=0,r){if(!(t instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(e))throw TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof c||this.layout instanceof h}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}class c extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readUIntLE(e,this.span)}encode(t,e,r=0){return s(e).writeUIntLE(t,r,this.span),this.span}}class h extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readUIntBE(e,this.span)}encode(t,e,r=0){return s(e).writeUIntBE(t,r,this.span),this.span}}function f(t){let e=Math.floor(t/0x100000000);return{hi32:e,lo32:t-0x100000000*e}}function d(t,e){return 0x100000000*t+e}class p extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t),i=r.readUInt32LE(e);return d(r.readUInt32LE(e+4),i)}encode(t,e,r=0){let i=f(t),n=s(e);return n.writeUInt32LE(i.lo32,r),n.writeUInt32LE(i.hi32,r+4),8}}class g extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t),i=r.readUInt32LE(e);return d(r.readInt32LE(e+4),i)}encode(t,e,r=0){let i=f(t),n=s(e);return n.writeUInt32LE(i.lo32,r),n.writeInt32LE(i.hi32,r+4),8}}class m extends o{constructor(t,e,r){if(!(t instanceof o))throw TypeError("elementLayout must be a Layout");if(!(e instanceof u&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;e instanceof u||!(0<t.span)||(i=e*t.span),super(i,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,i=this.count;if(i instanceof u&&(i=i.decode(t,e)),0<this.elementLayout.span)r=i*this.elementLayout.span;else{let n=0;for(;n<i;)r+=this.elementLayout.getSpan(t,e+r),++n}return r}decode(t,e=0){let r=[],i=0,n=this.count;for(n instanceof u&&(n=n.decode(t,e));i<n;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),i+=1;return r}encode(t,e,r=0){let i=this.elementLayout,n=t.reduce((t,n)=>t+i.encode(n,e,r+t),0);return this.count instanceof u&&this.count.encode(t.length,e,r),n}}class y extends o{constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((t,e)=>t&&e instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(const i of("boolean"==typeof e&&void 0===r&&(r=e,e=void 0),t))if(0>i.span&&void 0===i.property)throw Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((t,e)=>t+e.getSpan(),0)}catch(t){}super(i,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,i)=>{let n=i.getSpan(t,e);return e+=n,r+n},0)}catch(t){throw RangeError("indeterminate span")}return r}decode(t,e=0){n(t);let r=this.makeDestinationObject();for(let i of this.fields)if(void 0!==i.property&&(r[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){let i=r,n=0,s=0;for(let i of this.fields){let o=i.span;if(s=0<o?o:0,void 0!==i.property){let n=t[i.property];void 0!==n&&(s=i.encode(n,e,r),0>o&&(o=i.getSpan(e,r)))}n=r,r+=o}return n+s-i}fromArray(t){let e=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw TypeError("property must be string");let e=0;for(let r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}function w(t){return 0>t&&(t+=0x100000000),t}class b extends o{constructor(t,e,r){if(!(t instanceof c||t instanceof h))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let i=0;this._packedSetValue=function(t){return i=w(t),this},this._packedGetValue=function(){return i}}decode(t,e=0){let r=this.makeDestinationObject(),i=this.word.decode(t,e);for(let e of(this._packedSetValue(i),this.fields))void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){let i=this.word.decode(e,r);for(let e of(this._packedSetValue(i),this.fields))if(void 0!==e.property){let r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){let r=new v(this,t,e);return this.fields.push(r),r}addBoolean(t){let e=new k(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}}class v{constructor(t,e,r){if(!(t instanceof b))throw TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw TypeError("bits must be positive integer");const i=8*t.span,n=t.fields.reduce((t,e)=>t+e.bits,0);if(e+n>i)throw Error("bits too long for span remainder ("+(i-n)+" of "+i+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=0xffffffff),this.start=n,this.container.msb&&(this.start=i-n-e),this.wordMask=w(this.valueMask<<this.start),this.property=r}decode(t,e){return w(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==w(t&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),r=w(t<<this.start);this.container._packedSetValue(w(e&~this.wordMask)|r)}}class k extends v{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t*=1),super.encode(t)}}class S extends o{constructor(t,e){if(!(t instanceof u&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof u||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),s(t).slice(e,e+r)}encode(t,e,r){let i=this.length;if(this.length instanceof u&&(i=t.length),!(t instanceof Uint8Array&&i===t.length))throw TypeError(a("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>e.length)throw RangeError("encoding overruns Uint8Array");let n=s(t);return s(e).write(n.toString("hex"),r,i,"hex"),this.length instanceof u&&this.length.encode(i,e,r),i}}e.offset=(t,e,r)=>new l(t,e,r),e.u8=t=>new c(1,t),e.u16=t=>new c(2,t),e.u32=t=>new c(4,t),e.nu64=t=>new p(t),e.ns64=t=>new g(t),e.struct=(t,e,r)=>new y(t,e,r),e.seq=(t,e,r)=>new m(t,e,r),e.blob=(t,e)=>new S(t,e)},4763:function(t,e,r){"use strict";r.d(e,{Ng:()=>rE,ZX:()=>tx,Kt:()=>t_,J3:()=>ta,B2:()=>tE});var i,n,s,o,a=r(6826),u=r(706),l=r(9948),c=r.n(l),h=r(6846),f=r.n(h),d=r(6340),p=r(8866),g=r(5916);function m([t,e]){return`${t}=${function t(e){return Array.isArray(e)?"%5B"+e.map(t).join("%2C%20")+"%5D":"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}(e)}`}var y=class extends Error{cause=this.cause;context;constructor(...[t,e]){let r,i;if(e){const{cause:t,...n}=e;t&&(i={cause:t}),Object.keys(n).length>0&&(r=n)}super(function(t,e={}){{let r=`Solana error #${t}; Decode this error by running \`npx @solana/errors decode -- ${t}`;return Object.keys(e).length&&(r+=` '${btoa(Object.entries(e).map(m).join("&"))}'`),`${r}\``}}(t,r),i),this.context={__code:t,...r},this.name="SolanaError"}};function w(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function b(t){return t?.endian!==1}class v extends TypeError{constructor(t,e){let r;const{message:i,explanation:n,...s}=t,{path:o}=t,a=0===o.length?i:`At path: ${o.join(".")} -- ${i}`;super(n??a),null!=n&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}}function k(t){return"object"==typeof t&&null!=t}function S(t){return k(t)&&!Array.isArray(t)}function E(t){return"symbol"==typeof t?t.toString():"string"==typeof t?JSON.stringify(t):`${t}`}function*M(t,e,r,i){var n;for(let s of(k(n=t)&&"function"==typeof n[Symbol.iterator]||(t=[t]),t)){let t=function(t,e,r,i){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});let{path:n,branch:s}=e,{type:o}=r,{refinement:a,message:u=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${E(i)}\``}=t;return{value:i,type:o,refinement:a,key:n[n.length-1],path:n,branch:s,...t,message:u}}(s,e,r,i);t&&(yield t)}}function*A(t,e,r={}){let{path:i=[],branch:n=[t],coerce:s=!1,mask:o=!1}=r,a={path:i,branch:n,mask:o};s&&(t=e.coercer(t,a));let u="valid";for(let i of e.validator(t,a))i.explanation=r.message,u="not_valid",yield[i,void 0];for(let[l,c,h]of e.entries(t,a))for(let e of A(c,h,{path:void 0===l?i:[...i,l],branch:void 0===l?n:[...n,c],coerce:s,mask:o,message:r.message}))e[0]?(u=null!=e[0].refinement?"not_refined":"not_valid",yield[e[0],void 0]):s&&(c=e[1],void 0===l?t=c:t instanceof Map?t.set(l,c):t instanceof Set?t.add(c):k(t)&&(void 0!==c||l in t)&&(t[l]=c));if("not_valid"!==u)for(let i of e.refiner(t,a))i.explanation=r.message,u="not_refined",yield[i,void 0];"valid"===u&&(yield[void 0,t])}class I{constructor(t){const{type:e,schema:r,validator:i,refiner:n,coercer:s=t=>t,entries:o=function*(){}}=t;this.type=e,this.schema=r,this.entries=o,this.coercer=s,i?this.validator=(t,e)=>M(i(t,e),e,this,t):this.validator=()=>[],n?this.refiner=(t,e)=>M(n(t,e),e,this,t):this.refiner=()=>[]}assert(t,e){var r=t,i=this,n=e;let s=_(r,i,{message:n});if(s[0])throw s[0]}create(t,e){return x(t,this,e)}is(t){var e,r;return e=t,r=this,!_(e,r)[0]}mask(t,e){var r=t,i=this,n=e;let s=_(r,i,{coerce:!0,mask:!0,message:n});if(!s[0])return s[1];throw s[0]}validate(t,e={}){return _(t,this,e)}}function x(t,e,r){let i=_(t,e,{coerce:!0,message:r});if(!i[0])return i[1];throw i[0]}function _(t,e,r={}){let i=A(t,e,r),n=function(t){let{done:e,value:r}=t.next();return e?void 0:r}(i);return n[0]?[new v(n[0],function*(){for(let t of i)t[0]&&(yield t[0])}),void 0]:[void 0,n[1]]}function B(t,e){return new I({type:t,schema:null,validator:e})}function T(t){return new I({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,i]of e.entries())yield[r,i,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||`Expected an array value, but received: ${E(t)}`})}function C(){return B("boolean",t=>"boolean"==typeof t)}function R(t){return B("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${E(e)}`)}function P(t){let e=E(t),r=typeof t;return new I({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${E(r)}`})}function L(t){return new I({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function U(){return B("number",t=>"number"==typeof t&&!isNaN(t)||`Expected a number, but received: ${E(t)}`)}function O(t){return new I({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function W(t,e){return new I({type:"record",schema:null,*entries(r){if(k(r))for(let i in r){let n=r[i];yield[i,i,t],yield[i,n,e]}},validator:t=>S(t)||`Expected an object, but received: ${E(t)}`,coercer:t=>S(t)?{...t}:t})}function z(){return B("string",t=>"string"==typeof t||`Expected a string, but received: ${E(t)}`)}function N(t){let e=B("never",()=>!1);return new I({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let i=Math.max(t.length,r.length);for(let n=0;n<i;n++)yield[n,r[n],t[n]||e]}},validator:t=>Array.isArray(t)||`Expected an array, but received: ${E(t)}`,coercer:t=>Array.isArray(t)?t.slice():t})}function j(t){let e=Object.keys(t);return new I({type:"type",schema:t,*entries(r){if(k(r))for(let i of e)yield[i,r[i],t[i]]},validator:t=>S(t)||`Expected an object, but received: ${E(t)}`,coercer:t=>S(t)?{...t}:t})}function K(t){let e=t.map(t=>t.type).join(" | ");return new I({type:"union",schema:null,coercer(e,r){for(let i of t){let[t,n]=i.validate(e,{coerce:!0,mask:r.mask});if(!t)return n}return e},validator(r,i){let n=[];for(let e of t){let[...t]=A(r,e,i),[s]=t;if(!s[0])return[];for(let[e]of t)e&&n.push(e)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${E(r)}`,...n]}})}function q(){return B("unknown",()=>!0)}function D(t,e,r){return new I({...t,coercer:(i,n)=>_(i,e)[0]?t.coercer(i,n):t.coercer(r(i,n),n)})}var $=r(2466),F=r.n($),H=r(9977),V=class extends H.b{socket;constructor(t,e){super(),this.socket=new window.WebSocket(t,e.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=t=>this.emit("message",t.data),this.socket.onerror=t=>this.emit("error",t),this.socket.onclose=t=>{this.emit("close",t.code,t.reason)}}send(t,e,r){let i=r||e;try{this.socket.send(t),i()}catch(t){i(t)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,r){this.socket.addEventListener(t,e,r)}},J=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},Y=class extends H.b{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(t,e="ws://localhost:8080",{autoconnect:r=!0,reconnect:i=!0,reconnect_interval:n=1e3,max_reconnects:s=5,...o}={},a,u){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=r,this.ready=!1,this.reconnect=i,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=a||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),u?this.dataPack=u:this.dataPack=new J,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,e,r,i){return i||"object"!=typeof r||(i=r,r=null),new Promise((n,s)=>{if(!this.ready)return s(Error("socket not ready"));let o=this.generate_request_id(t,e);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e||void 0,id:o}),i,t=>{if(t)return s(t);this.queue[o]={promise:[n,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(t){let e=await this.call("rpc.login",t);if(!e)throw Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise((r,i)=>{if(!this.ready)return i(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e}),t=>{if(t)return i(t);r()})})}async subscribe(t){"string"==typeof t&&(t=[t]);let e=await this.call("rpc.on",t);if("string"==typeof t&&"ok"!==e[t])throw Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){"string"==typeof t&&(t=[t]);let e=await this.call("rpc.off",t);if("string"==typeof t&&"ok"!==e[t])throw Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket&&this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:t})=>{t instanceof ArrayBuffer&&(t=a.Buffer.from(t).toString());try{t=this.dataPack.decode(t)}catch(t){return}if(t.notification&&this.listeners(t.notification).length){if(!Object.keys(t.params).length)return this.emit(t.notification);let e=[t.notification];if(t.params.constructor===Object)e.push(t.params);else for(let r=0;r<t.params.length;r++)e.push(t.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,e)})}if(!this.queue[t.id])return t.method?Promise.resolve().then(()=>{this.emit(t.method,t?.params)}):void 0;"error"in t=="result"in t&&this.queue[t.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[t.id].timeout&&clearTimeout(this.queue[t.id].timeout),t.error?this.queue[t.id].promise[1](t.error):this.queue[t.id].promise[0](t.result),delete this.queue[t.id]}),this.socket.addEventListener("error",t=>this.emit("error",t)),this.socket.addEventListener("close",({code:r,reason:i})=>{this.ready&&setTimeout(()=>this.emit("close",r,i),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,e),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,i),1))})}},Z=r(4588),G=r(8390);u.ev.utils.randomPrivateKey;let Q=()=>{let t=u.ev.utils.randomPrivateKey(),e=X(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),{publicKey:e,secretKey:r}},X=u.ev.getPublicKey;function tt(t){try{return u.ev.ExtendedPoint.fromHex(t),!0}catch{return!1}}let te=(t,e)=>u.ev.sign(t,e.slice(0,32)),tr=u.ev.verify,ti=t=>a.Buffer.isBuffer(t)?t:t instanceof Uint8Array?a.Buffer.from(t.buffer,t.byteOffset,t.byteLength):a.Buffer.from(t);class tn{constructor(t){Object.assign(this,t)}encode(){return a.Buffer.from((0,p.serialize)(ts,this))}static decode(t){return(0,p.deserialize)(ts,this,t)}static decodeUnchecked(t){return(0,p.deserializeUnchecked)(ts,this,t)}}let ts=new Map,to=1;class ta extends tn{constructor(t){if(super({}),this._bn=void 0,void 0!==t._bn)this._bn=t._bn;else{if("string"==typeof t){const e=f().decode(t);if(32!=e.length)throw Error("Invalid public key input");this._bn=new(c())(e)}else this._bn=new(c())(t);if(this._bn.byteLength()>32)throw Error("Invalid public key input")}}static unique(){let t=new ta(to);return to+=1,new ta(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return f().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(a.Buffer);if(32===t.length)return t;let e=a.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){let i=a.Buffer.concat([t.toBuffer(),a.Buffer.from(e),r.toBuffer()]);return new ta((0,d.sc)(i))}static createProgramAddressSync(t,e){let r=a.Buffer.alloc(0);t.forEach(function(t){if(t.length>32)throw TypeError("Max seed length exceeded");r=a.Buffer.concat([r,ti(t)])}),r=a.Buffer.concat([r,e.toBuffer(),a.Buffer.from("ProgramDerivedAddress")]);let i=(0,d.sc)(r);if(tt(i))throw Error("Invalid seeds, address must fall off the curve");return new ta(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r,i=255;for(;0!=i;){try{let n=t.concat(a.Buffer.from([i]));r=this.createProgramAddressSync(n,e)}catch(t){if(t instanceof TypeError)throw t;i--;continue}return[r,i]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return tt(new ta(t).toBytes())}}ta.default=new ta("11111111111111111111111111111111"),ts.set(ta,{kind:"struct",fields:[["_bn","u256"]]}),new ta("BPFLoader1111111111111111111111111111111111");class tu extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tu.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class tl extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tl.prototype,"name",{value:"TransactionExpiredTimeoutError"});class tc extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tc.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class th{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments())if(t<e.length)return e[t];else t-=e.length}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw Error("Account index overflow encountered during compilation");let e=new Map;this.keySegments().flat().forEach((t,r)=>{e.set(t.toBase58(),r)});let r=t=>{let r=e.get(t.toBase58());if(void 0===r)throw 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}))}}let tf=(t="publicKey")=>g.blob(32,t),td=(t="string")=>{let e=g.struct([g.u32("length"),g.u32("lengthPadding"),g.blob(g.offset(g.u32(),-8),"chars")],t),r=e.decode.bind(e),i=e.encode.bind(e);return e.decode=(t,e)=>r(t,e).chars.toString(),e.encode=(t,e,r)=>i({chars:a.Buffer.from(t,"utf8")},e,r),e.alloc=t=>g.u32().span+g.u32().span+a.Buffer.from(t,"utf8").length,e};function tp(t){let e=0,r=0;for(;;){let i=t.shift();if(e|=(127&i)<<7*r,r+=1,(128&i)==0)break}return e}function tg(t,e){let r=e;for(;;){let e=127&r;if(0==(r>>=7)){t.push(e);break}e|=128,t.push(e)}}function tm(t,e){if(!t)throw Error(e||"Assertion failed")}class ty{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let r=new Map,i=t=>{let e=t.toBase58(),i=r.get(e);return void 0===i&&(i={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,i)),i},n=i(e);for(let e of(n.isSigner=!0,n.isWritable=!0,t))for(let t of(i(e.programId).isInvoked=!0,e.keys)){let e=i(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}return new ty(e,r)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];tm(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,t])=>t.isSigner&&t.isWritable),r=t.filter(([,t])=>t.isSigner&&!t.isWritable),i=t.filter(([,t])=>!t.isSigner&&t.isWritable),n=t.filter(([,t])=>!t.isSigner&&!t.isWritable),s={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:n.length};{tm(e.length>0,"Expected at least one writable signer key");let[t]=e[0];tm(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...e.map(([t])=>new ta(t)),...r.map(([t])=>new ta(t)),...i.map(([t])=>new ta(t)),...n.map(([t])=>new ta(t))]]}extractTableLookup(t){let[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&t.isWritable),[i,n]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&!t.isWritable);if(0!==e.length||0!==i.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:i},{writable:r,readonly:n}]}drainKeysFoundInLookupTable(t,e){let r=[],i=[];for(let[n,s]of this.keyMetaMap.entries())if(e(s)){let e=new ta(n),s=t.findIndex(t=>t.equals(e));s>=0&&(tm(s<256,"Max lookup table index exceeded"),r.push(s),i.push(e),this.keyMetaMap.delete(n))}return[r,i]}}let tw="Reached end of buffer unexpectedly";function tb(t){if(0===t.length)throw Error(tw);return t.shift()}function tv(t,...e){let[r]=e;if(2===e.length?r+(e[1]??0)>t.length:r>=t.length)throw Error(tw);return t.splice(...e)}class tk{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 ta(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:f().decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new th(this.staticAccountKeys)}static compile(t){let[e,r]=ty.compile(t.instructions,t.payerKey).getMessageComponents(),i=new th(r).compileInstructions(t.instructions).map(t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:f().encode(t.data)}));return new tk({header:e,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){let e=this.header.numRequiredSignatures;if(!(t>=this.header.numRequiredSignatures))return t<e-this.header.numReadonlySignedAccounts;{let r=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return t-e<r}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,e)=>!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];tg(e,t);let r=this.instructions.map(t=>{let{accounts:e,programIdIndex:r}=t,i=Array.from(f().decode(t.data)),n=[];tg(n,e.length);let s=[];return tg(s,i.length),{programIdIndex:r,keyIndicesCount:a.Buffer.from(n),keyIndices:e,dataLength:a.Buffer.from(s),data:i}}),i=[];tg(i,r.length);let n=a.Buffer.alloc(1232);a.Buffer.from(i).copy(n);let s=i.length;r.forEach(t=>{let e=g.struct([g.u8("programIdIndex"),g.blob(t.keyIndicesCount.length,"keyIndicesCount"),g.seq(g.u8("keyIndex"),t.keyIndices.length,"keyIndices"),g.blob(t.dataLength.length,"dataLength"),g.seq(g.u8("userdatum"),t.data.length,"data")]).encode(t,n,s);s+=e}),n=n.slice(0,s);let o=g.struct([g.blob(1,"numRequiredSignatures"),g.blob(1,"numReadonlySignedAccounts"),g.blob(1,"numReadonlyUnsignedAccounts"),g.blob(e.length,"keyCount"),g.seq(tf("key"),t,"keys"),tf("recentBlockhash")]),u={numRequiredSignatures:a.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:a.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:a.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:a.Buffer.from(e),keys:this.accountKeys.map(t=>ti(t.toBytes())),recentBlockhash:f().decode(this.recentBlockhash)},l=a.Buffer.alloc(2048),c=o.encode(u,l);return n.copy(l,c),l.slice(0,c+n.length)}static from(t){let e=[...t],r=tb(e);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=tb(e),n=tb(e),s=tp(e),o=[];for(let t=0;t<s;t++){let t=tv(e,0,32);o.push(new ta(a.Buffer.from(t)))}let u=tv(e,0,32),l=tp(e),c=[];for(let t=0;t<l;t++){let t=tb(e),r=tp(e),i=tv(e,0,r),n=tp(e),s=tv(e,0,n),o=f().encode(a.Buffer.from(s));c.push({programIdIndex:t,accounts:i,data:o})}return new tk({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:n},recentBlockhash:f().encode(a.Buffer.from(u)),accountKeys:o,instructions:c})}}class tS{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(let e of this.addressTableLookups)t+=e.readonlyIndexes.length+e.writableIndexes.length;return t}getAccountKeys(t){let e;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw Error("Failed to get account keys because address table lookups were not resolved");return new th(this.staticAccountKeys,e)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){let e=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(t>=r)return t-r<this.addressTableLookups.reduce((t,e)=>t+e.writableIndexes.length,0);if(!(t>=this.header.numRequiredSignatures))return t<e-this.header.numReadonlySignedAccounts;{let i=r-e-this.header.numReadonlyUnsignedAccounts;return t-e<i}}resolveAddressTableLookups(t){let e={writable:[],readonly:[]};for(let r of this.addressTableLookups){let i=t.find(t=>t.key.equals(r.accountKey));if(!i)throw Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(let t of r.writableIndexes)if(t<i.state.addresses.length)e.writable.push(i.state.addresses[t]);else throw Error(`Failed to find address for index ${t} in address lookup table ${r.accountKey.toBase58()}`);for(let t of r.readonlyIndexes)if(t<i.state.addresses.length)e.readonly.push(i.state.addresses[t]);else throw Error(`Failed to find address for index ${t} in address lookup table ${r.accountKey.toBase58()}`)}return e}static compile(t){let e=ty.compile(t.instructions,t.payerKey),r=[],i={writable:[],readonly:[]};for(let n of t.addressLookupTableAccounts||[]){let t=e.extractTableLookup(n);if(void 0!==t){let[e,{writable:n,readonly:s}]=t;r.push(e),i.writable.push(...n),i.readonly.push(...s)}}let[n,s]=e.getMessageComponents(),o=new th(s,i).compileInstructions(t.instructions);return new tS({header:n,staticAccountKeys:s,recentBlockhash:t.recentBlockhash,compiledInstructions:o,addressTableLookups:r})}serialize(){let t=[];tg(t,this.staticAccountKeys.length);let e=this.serializeInstructions(),r=[];tg(r,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),n=[];tg(n,this.addressTableLookups.length);let s=g.struct([g.u8("prefix"),g.struct([g.u8("numRequiredSignatures"),g.u8("numReadonlySignedAccounts"),g.u8("numReadonlyUnsignedAccounts")],"header"),g.blob(t.length,"staticAccountKeysLength"),g.seq(tf(),this.staticAccountKeys.length,"staticAccountKeys"),tf("recentBlockhash"),g.blob(r.length,"instructionsLength"),g.blob(e.length,"serializedInstructions"),g.blob(n.length,"addressTableLookupsLength"),g.blob(i.length,"serializedAddressTableLookups")]),o=new Uint8Array(1232),a=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(t=>t.toBytes()),recentBlockhash:f().decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(n),serializedAddressTableLookups:i},o);return o.slice(0,a)}serializeInstructions(){let t=0,e=new Uint8Array(1232);for(let r of this.compiledInstructions){let i=[];tg(i,r.accountKeyIndexes.length);let n=[];tg(n,r.data.length);let s=g.struct([g.u8("programIdIndex"),g.blob(i.length,"encodedAccountKeyIndexesLength"),g.seq(g.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),g.blob(n.length,"encodedDataLength"),g.blob(r.data.length,"data")]);t+=s.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(n),data:r.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0,e=new Uint8Array(1232);for(let r of this.addressTableLookups){let i=[];tg(i,r.writableIndexes.length);let n=[];tg(n,r.readonlyIndexes.length);let s=g.struct([tf("accountKey"),g.blob(i.length,"encodedWritableIndexesLength"),g.seq(g.u8(),r.writableIndexes.length,"writableIndexes"),g.blob(n.length,"encodedReadonlyIndexesLength"),g.seq(g.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=s.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(n),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t],r=tb(e),i=127&r;tm(r!==i,"Expected versioned message but received legacy message"),tm(0===i,`Expected versioned message with version 0 but found version ${i}`);let n={numRequiredSignatures:tb(e),numReadonlySignedAccounts:tb(e),numReadonlyUnsignedAccounts:tb(e)},s=[],o=tp(e);for(let t=0;t<o;t++)s.push(new ta(tv(e,0,32)));let a=f().encode(tv(e,0,32)),u=tp(e),l=[];for(let t=0;t<u;t++){let t=tb(e),r=tp(e),i=tv(e,0,r),n=tp(e),s=new Uint8Array(tv(e,0,n));l.push({programIdIndex:t,accountKeyIndexes:i,data:s})}let c=tp(e),h=[];for(let t=0;t<c;t++){let t=new ta(tv(e,0,32)),r=tp(e),i=tv(e,0,r),n=tp(e),s=tv(e,0,n);h.push({accountKey:t,writableIndexes:i,readonlyIndexes:s})}return new tS({header:n,staticAccountKeys:s,recentBlockhash:a,compiledInstructions:l,addressTableLookups:h})}}let tE={deserializeMessageVersion(t){let e=t[0],r=127&e;return r===e?"legacy":r},deserialize:t=>{let e=tE.deserializeMessageVersion(t);if("legacy"===e)return tk.from(t);if(0===e)return tS.deserialize(t);throw Error(`Transaction message version ${e} deserialization is not supported`)}},tM=((i={})[i.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",i[i.PROCESSED=1]="PROCESSED",i[i.TIMED_OUT=2]="TIMED_OUT",i[i.NONCE_INVALID=3]="NONCE_INVALID",i),tA=a.Buffer.alloc(64).fill(0);class tI{constructor(t){this.keys=void 0,this.programId=void 0,this.data=a.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 tx{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)return;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 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 tI(t))}),this}compileMessage(){let t,e,r;if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;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 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)r=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw Error(`Transaction instruction index ${t} has undefined program id`);let i=[],n=[];e.forEach(t=>{t.keys.forEach(t=>{n.push({...t})});let e=t.programId.toString();i.includes(e)||i.push(e)}),i.forEach(t=>{n.push({pubkey:new ta(t),isSigner:!1,isWritable:!1})});let s=[];n.forEach(t=>{let e=t.pubkey.toString(),r=s.findIndex(t=>t.pubkey.toString()===e);r>-1?(s[r].isWritable=s[r].isWritable||t.isWritable,s[r].isSigner=s[r].isSigner||t.isSigner):s.push(t)}),s.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"})});let o=s.findIndex(t=>t.pubkey.equals(r));if(o>-1){let[t]=s.splice(o,1);t.isSigner=!0,t.isWritable=!0,s.unshift(t)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let t of this.signatures){let e=s.findIndex(e=>e.pubkey.equals(t.publicKey));if(e>-1)s[e].isSigner||(s[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."));else throw Error(`unknown signer: ${t.publicKey.toString()}`)}let a=0,u=0,l=0,c=[],h=[];s.forEach(({pubkey:t,isSigner:e,isWritable:r})=>{e?(c.push(t.toString()),a+=1,r||(u+=1)):(h.push(t.toString()),r||(l+=1))});let d=c.concat(h),p=e.map(t=>{let{data:e,programId:r}=t;return{programIdIndex:d.indexOf(r.toString()),accounts:t.keys.map(t=>d.indexOf(t.pubkey.toString())),data:f().encode(e)}});return p.forEach(t=>{tm(t.programIdIndex>=0),t.accounts.forEach(t=>tm(t>=0))}),new tk({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:d,recentBlockhash:t,instructions:p})}_compile(){let 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))?t:(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 Error("No signers");let e=new Set;this.signatures=t.filter(t=>{let r=t.toString();return!e.has(r)&&(e.add(r),!0)}).map(t=>({signature:null,publicKey:t}))}sign(...t){if(0===t.length)throw Error("No signers");let e=new Set,r=[];for(let i of t){let t=i.publicKey.toString();e.has(t)||(e.add(t),r.push(i))}this.signatures=r.map(t=>({signature:null,publicKey:t.publicKey}));let i=this._compile();this._partialSign(i,...r)}partialSign(...t){if(0===t.length)throw Error("No signers");let e=new Set,r=[];for(let i of t){let t=i.publicKey.toString();e.has(t)||(e.add(t),r.push(i))}let i=this._compile();this._partialSign(i,...r)}_partialSign(t,...e){let r=t.serialize();e.forEach(t=>{let e=te(r,t.secretKey);this._addSignature(t.publicKey,ti(e))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){tm(64===e.length);let r=this.signatures.findIndex(e=>t.equals(e.publicKey));if(r<0)throw Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=a.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let r={};for(let{signature:i,publicKey:n}of this.signatures)null===i?e&&(r.missing||=[]).push(n):tr(i,t,n.toBytes())||(r.invalid||=[]).push(n);return r.invalid||r.missing?r:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),i=this.serializeMessage();if(r){let t=this._getMessageSignednessErrors(i,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`
|
|
1
|
+
(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["188"],{5916:function(t,e,r){"use strict";e.nu64=e.u32=e.u16=e.u8=e.offset=void 0,e.blob=e.seq=e.struct=e.ns64=void 0;let i=r(6826);function n(t){if(!(t instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(t){return n(t),i.Buffer.from(t.buffer,t.byteOffset,t.length)}class o{constructor(t,e){if(!Number.isInteger(t))throw TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function a(t,e){return e.property?t+"["+e.property+"]":t}class u extends o{isCount(){throw Error("ExternalLayout is abstract")}}class l extends u{constructor(t,e=0,r){if(!(t instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(e))throw TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof c||this.layout instanceof h}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}class c extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readUIntLE(e,this.span)}encode(t,e,r=0){return s(e).writeUIntLE(t,r,this.span),this.span}}class h extends o{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e=0){return s(t).readUIntBE(e,this.span)}encode(t,e,r=0){return s(e).writeUIntBE(t,r,this.span),this.span}}function f(t){let e=Math.floor(t/0x100000000);return{hi32:e,lo32:t-0x100000000*e}}function d(t,e){return 0x100000000*t+e}class p extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t),i=r.readUInt32LE(e);return d(r.readUInt32LE(e+4),i)}encode(t,e,r=0){let i=f(t),n=s(e);return n.writeUInt32LE(i.lo32,r),n.writeUInt32LE(i.hi32,r+4),8}}class g extends o{constructor(t){super(8,t)}decode(t,e=0){let r=s(t),i=r.readUInt32LE(e);return d(r.readInt32LE(e+4),i)}encode(t,e,r=0){let i=f(t),n=s(e);return n.writeUInt32LE(i.lo32,r),n.writeInt32LE(i.hi32,r+4),8}}class m extends o{constructor(t,e,r){if(!(t instanceof o))throw TypeError("elementLayout must be a Layout");if(!(e instanceof u&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;e instanceof u||!(0<t.span)||(i=e*t.span),super(i,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,i=this.count;if(i instanceof u&&(i=i.decode(t,e)),0<this.elementLayout.span)r=i*this.elementLayout.span;else{let n=0;for(;n<i;)r+=this.elementLayout.getSpan(t,e+r),++n}return r}decode(t,e=0){let r=[],i=0,n=this.count;for(n instanceof u&&(n=n.decode(t,e));i<n;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),i+=1;return r}encode(t,e,r=0){let i=this.elementLayout,n=t.reduce((t,n)=>t+i.encode(n,e,r+t),0);return this.count instanceof u&&this.count.encode(t.length,e,r),n}}class y extends o{constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((t,e)=>t&&e instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(const i of("boolean"==typeof e&&void 0===r&&(r=e,e=void 0),t))if(0>i.span&&void 0===i.property)throw Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((t,e)=>t+e.getSpan(),0)}catch(t){}super(i,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,i)=>{let n=i.getSpan(t,e);return e+=n,r+n},0)}catch(t){throw RangeError("indeterminate span")}return r}decode(t,e=0){n(t);let r=this.makeDestinationObject();for(let i of this.fields)if(void 0!==i.property&&(r[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){let i=r,n=0,s=0;for(let i of this.fields){let o=i.span;if(s=0<o?o:0,void 0!==i.property){let n=t[i.property];void 0!==n&&(s=i.encode(n,e,r),0>o&&(o=i.getSpan(e,r)))}n=r,r+=o}return n+s-i}fromArray(t){let e=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw TypeError("property must be string");let e=0;for(let r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}function w(t){return 0>t&&(t+=0x100000000),t}class b extends o{constructor(t,e,r){if(!(t instanceof c||t instanceof h))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let i=0;this._packedSetValue=function(t){return i=w(t),this},this._packedGetValue=function(){return i}}decode(t,e=0){let r=this.makeDestinationObject(),i=this.word.decode(t,e);for(let e of(this._packedSetValue(i),this.fields))void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){let i=this.word.decode(e,r);for(let e of(this._packedSetValue(i),this.fields))if(void 0!==e.property){let r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){let r=new v(this,t,e);return this.fields.push(r),r}addBoolean(t){let e=new k(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}}class v{constructor(t,e,r){if(!(t instanceof b))throw TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw TypeError("bits must be positive integer");const i=8*t.span,n=t.fields.reduce((t,e)=>t+e.bits,0);if(e+n>i)throw Error("bits too long for span remainder ("+(i-n)+" of "+i+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=0xffffffff),this.start=n,this.container.msb&&(this.start=i-n-e),this.wordMask=w(this.valueMask<<this.start),this.property=r}decode(t,e){return w(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==w(t&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),r=w(t<<this.start);this.container._packedSetValue(w(e&~this.wordMask)|r)}}class k extends v{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t*=1),super.encode(t)}}class S extends o{constructor(t,e){if(!(t instanceof u&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof u||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),s(t).slice(e,e+r)}encode(t,e,r){let i=this.length;if(this.length instanceof u&&(i=t.length),!(t instanceof Uint8Array&&i===t.length))throw TypeError(a("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>e.length)throw RangeError("encoding overruns Uint8Array");let n=s(t);return s(e).write(n.toString("hex"),r,i,"hex"),this.length instanceof u&&this.length.encode(i,e,r),i}}e.offset=(t,e,r)=>new l(t,e,r),e.u8=t=>new c(1,t),e.u16=t=>new c(2,t),e.u32=t=>new c(4,t),e.nu64=t=>new p(t),e.ns64=t=>new g(t),e.struct=(t,e,r)=>new y(t,e,r),e.seq=(t,e,r)=>new m(t,e,r),e.blob=(t,e)=>new S(t,e)},9836:function(t,e,r){"use strict";r.d(e,{Ng:()=>rE,ZX:()=>tx,Kt:()=>t_,J3:()=>ta,B2:()=>tE});var i,n,s,o,a=r(6826),u=r(706),l=r(9948),c=r.n(l),h=r(6846),f=r.n(h),d=r(6340),p=r(8866),g=r(5916);function m([t,e]){return`${t}=${function t(e){return Array.isArray(e)?"%5B"+e.map(t).join("%2C%20")+"%5D":"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}(e)}`}var y=class extends Error{cause=this.cause;context;constructor(...[t,e]){let r,i;if(e){const{cause:t,...n}=e;t&&(i={cause:t}),Object.keys(n).length>0&&(r=n)}super(function(t,e={}){{let r=`Solana error #${t}; Decode this error by running \`npx @solana/errors decode -- ${t}`;return Object.keys(e).length&&(r+=` '${btoa(Object.entries(e).map(m).join("&"))}'`),`${r}\``}}(t,r),i),this.context={__code:t,...r},this.name="SolanaError"}};function w(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function b(t){return t?.endian!==1}class v extends TypeError{constructor(t,e){let r;const{message:i,explanation:n,...s}=t,{path:o}=t,a=0===o.length?i:`At path: ${o.join(".")} -- ${i}`;super(n??a),null!=n&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}}function k(t){return"object"==typeof t&&null!=t}function S(t){return k(t)&&!Array.isArray(t)}function E(t){return"symbol"==typeof t?t.toString():"string"==typeof t?JSON.stringify(t):`${t}`}function*M(t,e,r,i){var n;for(let s of(k(n=t)&&"function"==typeof n[Symbol.iterator]||(t=[t]),t)){let t=function(t,e,r,i){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});let{path:n,branch:s}=e,{type:o}=r,{refinement:a,message:u=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${E(i)}\``}=t;return{value:i,type:o,refinement:a,key:n[n.length-1],path:n,branch:s,...t,message:u}}(s,e,r,i);t&&(yield t)}}function*A(t,e,r={}){let{path:i=[],branch:n=[t],coerce:s=!1,mask:o=!1}=r,a={path:i,branch:n,mask:o};s&&(t=e.coercer(t,a));let u="valid";for(let i of e.validator(t,a))i.explanation=r.message,u="not_valid",yield[i,void 0];for(let[l,c,h]of e.entries(t,a))for(let e of A(c,h,{path:void 0===l?i:[...i,l],branch:void 0===l?n:[...n,c],coerce:s,mask:o,message:r.message}))e[0]?(u=null!=e[0].refinement?"not_refined":"not_valid",yield[e[0],void 0]):s&&(c=e[1],void 0===l?t=c:t instanceof Map?t.set(l,c):t instanceof Set?t.add(c):k(t)&&(void 0!==c||l in t)&&(t[l]=c));if("not_valid"!==u)for(let i of e.refiner(t,a))i.explanation=r.message,u="not_refined",yield[i,void 0];"valid"===u&&(yield[void 0,t])}class I{constructor(t){const{type:e,schema:r,validator:i,refiner:n,coercer:s=t=>t,entries:o=function*(){}}=t;this.type=e,this.schema=r,this.entries=o,this.coercer=s,i?this.validator=(t,e)=>M(i(t,e),e,this,t):this.validator=()=>[],n?this.refiner=(t,e)=>M(n(t,e),e,this,t):this.refiner=()=>[]}assert(t,e){var r=t,i=this,n=e;let s=_(r,i,{message:n});if(s[0])throw s[0]}create(t,e){return x(t,this,e)}is(t){var e,r;return e=t,r=this,!_(e,r)[0]}mask(t,e){var r=t,i=this,n=e;let s=_(r,i,{coerce:!0,mask:!0,message:n});if(!s[0])return s[1];throw s[0]}validate(t,e={}){return _(t,this,e)}}function x(t,e,r){let i=_(t,e,{coerce:!0,message:r});if(!i[0])return i[1];throw i[0]}function _(t,e,r={}){let i=A(t,e,r),n=function(t){let{done:e,value:r}=t.next();return e?void 0:r}(i);return n[0]?[new v(n[0],function*(){for(let t of i)t[0]&&(yield t[0])}),void 0]:[void 0,n[1]]}function B(t,e){return new I({type:t,schema:null,validator:e})}function T(t){return new I({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,i]of e.entries())yield[r,i,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||`Expected an array value, but received: ${E(t)}`})}function C(){return B("boolean",t=>"boolean"==typeof t)}function R(t){return B("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${E(e)}`)}function P(t){let e=E(t),r=typeof t;return new I({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${E(r)}`})}function L(t){return new I({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function U(){return B("number",t=>"number"==typeof t&&!isNaN(t)||`Expected a number, but received: ${E(t)}`)}function O(t){return new I({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function W(t,e){return new I({type:"record",schema:null,*entries(r){if(k(r))for(let i in r){let n=r[i];yield[i,i,t],yield[i,n,e]}},validator:t=>S(t)||`Expected an object, but received: ${E(t)}`,coercer:t=>S(t)?{...t}:t})}function z(){return B("string",t=>"string"==typeof t||`Expected a string, but received: ${E(t)}`)}function N(t){let e=B("never",()=>!1);return new I({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let i=Math.max(t.length,r.length);for(let n=0;n<i;n++)yield[n,r[n],t[n]||e]}},validator:t=>Array.isArray(t)||`Expected an array, but received: ${E(t)}`,coercer:t=>Array.isArray(t)?t.slice():t})}function j(t){let e=Object.keys(t);return new I({type:"type",schema:t,*entries(r){if(k(r))for(let i of e)yield[i,r[i],t[i]]},validator:t=>S(t)||`Expected an object, but received: ${E(t)}`,coercer:t=>S(t)?{...t}:t})}function K(t){let e=t.map(t=>t.type).join(" | ");return new I({type:"union",schema:null,coercer(e,r){for(let i of t){let[t,n]=i.validate(e,{coerce:!0,mask:r.mask});if(!t)return n}return e},validator(r,i){let n=[];for(let e of t){let[...t]=A(r,e,i),[s]=t;if(!s[0])return[];for(let[e]of t)e&&n.push(e)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${E(r)}`,...n]}})}function q(){return B("unknown",()=>!0)}function D(t,e,r){return new I({...t,coercer:(i,n)=>_(i,e)[0]?t.coercer(i,n):t.coercer(r(i,n),n)})}var $=r(2466),F=r.n($),H=r(9977),V=class extends H.b{socket;constructor(t,e){super(),this.socket=new window.WebSocket(t,e.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=t=>this.emit("message",t.data),this.socket.onerror=t=>this.emit("error",t),this.socket.onclose=t=>{this.emit("close",t.code,t.reason)}}send(t,e,r){let i=r||e;try{this.socket.send(t),i()}catch(t){i(t)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,r){this.socket.addEventListener(t,e,r)}},J=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},Y=class extends H.b{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(t,e="ws://localhost:8080",{autoconnect:r=!0,reconnect:i=!0,reconnect_interval:n=1e3,max_reconnects:s=5,...o}={},a,u){super(),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=r,this.ready=!1,this.reconnect=i,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=a||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),u?this.dataPack=u:this.dataPack=new J,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,e,r,i){return i||"object"!=typeof r||(i=r,r=null),new Promise((n,s)=>{if(!this.ready)return s(Error("socket not ready"));let o=this.generate_request_id(t,e);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e||void 0,id:o}),i,t=>{if(t)return s(t);this.queue[o]={promise:[n,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(t){let e=await this.call("rpc.login",t);if(!e)throw Error("authentication failed");return e}async listMethods(){return await this.call("__listMethods")}notify(t,e){return new Promise((r,i)=>{if(!this.ready)return i(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e}),t=>{if(t)return i(t);r()})})}async subscribe(t){"string"==typeof t&&(t=[t]);let e=await this.call("rpc.on",t);if("string"==typeof t&&"ok"!==e[t])throw Error("Failed subscribing to an event '"+t+"' with: "+e[t]);return e}async unsubscribe(t){"string"==typeof t&&(t=[t]);let e=await this.call("rpc.off",t);if("string"==typeof t&&"ok"!==e[t])throw Error("Failed unsubscribing from an event with: "+e);return e}close(t,e){this.socket&&this.socket.close(t||1e3,e)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(t,e){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:t})=>{t instanceof ArrayBuffer&&(t=a.Buffer.from(t).toString());try{t=this.dataPack.decode(t)}catch(t){return}if(t.notification&&this.listeners(t.notification).length){if(!Object.keys(t.params).length)return this.emit(t.notification);let e=[t.notification];if(t.params.constructor===Object)e.push(t.params);else for(let r=0;r<t.params.length;r++)e.push(t.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,e)})}if(!this.queue[t.id])return t.method?Promise.resolve().then(()=>{this.emit(t.method,t?.params)}):void 0;"error"in t=="result"in t&&this.queue[t.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[t.id].timeout&&clearTimeout(this.queue[t.id].timeout),t.error?this.queue[t.id].promise[1](t.error):this.queue[t.id].promise[0](t.result),delete this.queue[t.id]}),this.socket.addEventListener("error",t=>this.emit("error",t)),this.socket.addEventListener("close",({code:r,reason:i})=>{this.ready&&setTimeout(()=>this.emit("close",r,i),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,e),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,i),1))})}},Z=r(4588),G=r(8390);u.ev.utils.randomPrivateKey;let Q=()=>{let t=u.ev.utils.randomPrivateKey(),e=X(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),{publicKey:e,secretKey:r}},X=u.ev.getPublicKey;function tt(t){try{return u.ev.ExtendedPoint.fromHex(t),!0}catch{return!1}}let te=(t,e)=>u.ev.sign(t,e.slice(0,32)),tr=u.ev.verify,ti=t=>a.Buffer.isBuffer(t)?t:t instanceof Uint8Array?a.Buffer.from(t.buffer,t.byteOffset,t.byteLength):a.Buffer.from(t);class tn{constructor(t){Object.assign(this,t)}encode(){return a.Buffer.from((0,p.serialize)(ts,this))}static decode(t){return(0,p.deserialize)(ts,this,t)}static decodeUnchecked(t){return(0,p.deserializeUnchecked)(ts,this,t)}}let ts=new Map,to=1;class ta extends tn{constructor(t){if(super({}),this._bn=void 0,void 0!==t._bn)this._bn=t._bn;else{if("string"==typeof t){const e=f().decode(t);if(32!=e.length)throw Error("Invalid public key input");this._bn=new(c())(e)}else this._bn=new(c())(t);if(this._bn.byteLength()>32)throw Error("Invalid public key input")}}static unique(){let t=new ta(to);return to+=1,new ta(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return f().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(a.Buffer);if(32===t.length)return t;let e=a.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){let i=a.Buffer.concat([t.toBuffer(),a.Buffer.from(e),r.toBuffer()]);return new ta((0,d.sc)(i))}static createProgramAddressSync(t,e){let r=a.Buffer.alloc(0);t.forEach(function(t){if(t.length>32)throw TypeError("Max seed length exceeded");r=a.Buffer.concat([r,ti(t)])}),r=a.Buffer.concat([r,e.toBuffer(),a.Buffer.from("ProgramDerivedAddress")]);let i=(0,d.sc)(r);if(tt(i))throw Error("Invalid seeds, address must fall off the curve");return new ta(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r,i=255;for(;0!=i;){try{let n=t.concat(a.Buffer.from([i]));r=this.createProgramAddressSync(n,e)}catch(t){if(t instanceof TypeError)throw t;i--;continue}return[r,i]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return tt(new ta(t).toBytes())}}ta.default=new ta("11111111111111111111111111111111"),ts.set(ta,{kind:"struct",fields:[["_bn","u256"]]}),new ta("BPFLoader1111111111111111111111111111111111");class tu extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tu.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class tl extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tl.prototype,"name",{value:"TransactionExpiredTimeoutError"});class tc extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(tc.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class th{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments())if(t<e.length)return e[t];else t-=e.length}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw Error("Account index overflow encountered during compilation");let e=new Map;this.keySegments().flat().forEach((t,r)=>{e.set(t.toBase58(),r)});let r=t=>{let r=e.get(t.toBase58());if(void 0===r)throw 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}))}}let tf=(t="publicKey")=>g.blob(32,t),td=(t="string")=>{let e=g.struct([g.u32("length"),g.u32("lengthPadding"),g.blob(g.offset(g.u32(),-8),"chars")],t),r=e.decode.bind(e),i=e.encode.bind(e);return e.decode=(t,e)=>r(t,e).chars.toString(),e.encode=(t,e,r)=>i({chars:a.Buffer.from(t,"utf8")},e,r),e.alloc=t=>g.u32().span+g.u32().span+a.Buffer.from(t,"utf8").length,e};function tp(t){let e=0,r=0;for(;;){let i=t.shift();if(e|=(127&i)<<7*r,r+=1,(128&i)==0)break}return e}function tg(t,e){let r=e;for(;;){let e=127&r;if(0==(r>>=7)){t.push(e);break}e|=128,t.push(e)}}function tm(t,e){if(!t)throw Error(e||"Assertion failed")}class ty{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let r=new Map,i=t=>{let e=t.toBase58(),i=r.get(e);return void 0===i&&(i={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,i)),i},n=i(e);for(let e of(n.isSigner=!0,n.isWritable=!0,t))for(let t of(i(e.programId).isInvoked=!0,e.keys)){let e=i(t.pubkey);e.isSigner||=t.isSigner,e.isWritable||=t.isWritable}return new ty(e,r)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];tm(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,t])=>t.isSigner&&t.isWritable),r=t.filter(([,t])=>t.isSigner&&!t.isWritable),i=t.filter(([,t])=>!t.isSigner&&t.isWritable),n=t.filter(([,t])=>!t.isSigner&&!t.isWritable),s={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:n.length};{tm(e.length>0,"Expected at least one writable signer key");let[t]=e[0];tm(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...e.map(([t])=>new ta(t)),...r.map(([t])=>new ta(t)),...i.map(([t])=>new ta(t)),...n.map(([t])=>new ta(t))]]}extractTableLookup(t){let[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&t.isWritable),[i,n]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&!t.isWritable);if(0!==e.length||0!==i.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:i},{writable:r,readonly:n}]}drainKeysFoundInLookupTable(t,e){let r=[],i=[];for(let[n,s]of this.keyMetaMap.entries())if(e(s)){let e=new ta(n),s=t.findIndex(t=>t.equals(e));s>=0&&(tm(s<256,"Max lookup table index exceeded"),r.push(s),i.push(e),this.keyMetaMap.delete(n))}return[r,i]}}let tw="Reached end of buffer unexpectedly";function tb(t){if(0===t.length)throw Error(tw);return t.shift()}function tv(t,...e){let[r]=e;if(2===e.length?r+(e[1]??0)>t.length:r>=t.length)throw Error(tw);return t.splice(...e)}class tk{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 ta(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:f().decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new th(this.staticAccountKeys)}static compile(t){let[e,r]=ty.compile(t.instructions,t.payerKey).getMessageComponents(),i=new th(r).compileInstructions(t.instructions).map(t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:f().encode(t.data)}));return new tk({header:e,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){let e=this.header.numRequiredSignatures;if(!(t>=this.header.numRequiredSignatures))return t<e-this.header.numReadonlySignedAccounts;{let r=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return t-e<r}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,e)=>!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];tg(e,t);let r=this.instructions.map(t=>{let{accounts:e,programIdIndex:r}=t,i=Array.from(f().decode(t.data)),n=[];tg(n,e.length);let s=[];return tg(s,i.length),{programIdIndex:r,keyIndicesCount:a.Buffer.from(n),keyIndices:e,dataLength:a.Buffer.from(s),data:i}}),i=[];tg(i,r.length);let n=a.Buffer.alloc(1232);a.Buffer.from(i).copy(n);let s=i.length;r.forEach(t=>{let e=g.struct([g.u8("programIdIndex"),g.blob(t.keyIndicesCount.length,"keyIndicesCount"),g.seq(g.u8("keyIndex"),t.keyIndices.length,"keyIndices"),g.blob(t.dataLength.length,"dataLength"),g.seq(g.u8("userdatum"),t.data.length,"data")]).encode(t,n,s);s+=e}),n=n.slice(0,s);let o=g.struct([g.blob(1,"numRequiredSignatures"),g.blob(1,"numReadonlySignedAccounts"),g.blob(1,"numReadonlyUnsignedAccounts"),g.blob(e.length,"keyCount"),g.seq(tf("key"),t,"keys"),tf("recentBlockhash")]),u={numRequiredSignatures:a.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:a.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:a.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:a.Buffer.from(e),keys:this.accountKeys.map(t=>ti(t.toBytes())),recentBlockhash:f().decode(this.recentBlockhash)},l=a.Buffer.alloc(2048),c=o.encode(u,l);return n.copy(l,c),l.slice(0,c+n.length)}static from(t){let e=[...t],r=tb(e);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=tb(e),n=tb(e),s=tp(e),o=[];for(let t=0;t<s;t++){let t=tv(e,0,32);o.push(new ta(a.Buffer.from(t)))}let u=tv(e,0,32),l=tp(e),c=[];for(let t=0;t<l;t++){let t=tb(e),r=tp(e),i=tv(e,0,r),n=tp(e),s=tv(e,0,n),o=f().encode(a.Buffer.from(s));c.push({programIdIndex:t,accounts:i,data:o})}return new tk({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:n},recentBlockhash:f().encode(a.Buffer.from(u)),accountKeys:o,instructions:c})}}class tS{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(let e of this.addressTableLookups)t+=e.readonlyIndexes.length+e.writableIndexes.length;return t}getAccountKeys(t){let e;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw Error("Failed to get account keys because address table lookups were not resolved");return new th(this.staticAccountKeys,e)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){let e=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(t>=r)return t-r<this.addressTableLookups.reduce((t,e)=>t+e.writableIndexes.length,0);if(!(t>=this.header.numRequiredSignatures))return t<e-this.header.numReadonlySignedAccounts;{let i=r-e-this.header.numReadonlyUnsignedAccounts;return t-e<i}}resolveAddressTableLookups(t){let e={writable:[],readonly:[]};for(let r of this.addressTableLookups){let i=t.find(t=>t.key.equals(r.accountKey));if(!i)throw Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(let t of r.writableIndexes)if(t<i.state.addresses.length)e.writable.push(i.state.addresses[t]);else throw Error(`Failed to find address for index ${t} in address lookup table ${r.accountKey.toBase58()}`);for(let t of r.readonlyIndexes)if(t<i.state.addresses.length)e.readonly.push(i.state.addresses[t]);else throw Error(`Failed to find address for index ${t} in address lookup table ${r.accountKey.toBase58()}`)}return e}static compile(t){let e=ty.compile(t.instructions,t.payerKey),r=[],i={writable:[],readonly:[]};for(let n of t.addressLookupTableAccounts||[]){let t=e.extractTableLookup(n);if(void 0!==t){let[e,{writable:n,readonly:s}]=t;r.push(e),i.writable.push(...n),i.readonly.push(...s)}}let[n,s]=e.getMessageComponents(),o=new th(s,i).compileInstructions(t.instructions);return new tS({header:n,staticAccountKeys:s,recentBlockhash:t.recentBlockhash,compiledInstructions:o,addressTableLookups:r})}serialize(){let t=[];tg(t,this.staticAccountKeys.length);let e=this.serializeInstructions(),r=[];tg(r,this.compiledInstructions.length);let i=this.serializeAddressTableLookups(),n=[];tg(n,this.addressTableLookups.length);let s=g.struct([g.u8("prefix"),g.struct([g.u8("numRequiredSignatures"),g.u8("numReadonlySignedAccounts"),g.u8("numReadonlyUnsignedAccounts")],"header"),g.blob(t.length,"staticAccountKeysLength"),g.seq(tf(),this.staticAccountKeys.length,"staticAccountKeys"),tf("recentBlockhash"),g.blob(r.length,"instructionsLength"),g.blob(e.length,"serializedInstructions"),g.blob(n.length,"addressTableLookupsLength"),g.blob(i.length,"serializedAddressTableLookups")]),o=new Uint8Array(1232),a=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(t=>t.toBytes()),recentBlockhash:f().decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(n),serializedAddressTableLookups:i},o);return o.slice(0,a)}serializeInstructions(){let t=0,e=new Uint8Array(1232);for(let r of this.compiledInstructions){let i=[];tg(i,r.accountKeyIndexes.length);let n=[];tg(n,r.data.length);let s=g.struct([g.u8("programIdIndex"),g.blob(i.length,"encodedAccountKeyIndexesLength"),g.seq(g.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),g.blob(n.length,"encodedDataLength"),g.blob(r.data.length,"data")]);t+=s.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(n),data:r.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0,e=new Uint8Array(1232);for(let r of this.addressTableLookups){let i=[];tg(i,r.writableIndexes.length);let n=[];tg(n,r.readonlyIndexes.length);let s=g.struct([tf("accountKey"),g.blob(i.length,"encodedWritableIndexesLength"),g.seq(g.u8(),r.writableIndexes.length,"writableIndexes"),g.blob(n.length,"encodedReadonlyIndexesLength"),g.seq(g.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=s.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(n),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t],r=tb(e),i=127&r;tm(r!==i,"Expected versioned message but received legacy message"),tm(0===i,`Expected versioned message with version 0 but found version ${i}`);let n={numRequiredSignatures:tb(e),numReadonlySignedAccounts:tb(e),numReadonlyUnsignedAccounts:tb(e)},s=[],o=tp(e);for(let t=0;t<o;t++)s.push(new ta(tv(e,0,32)));let a=f().encode(tv(e,0,32)),u=tp(e),l=[];for(let t=0;t<u;t++){let t=tb(e),r=tp(e),i=tv(e,0,r),n=tp(e),s=new Uint8Array(tv(e,0,n));l.push({programIdIndex:t,accountKeyIndexes:i,data:s})}let c=tp(e),h=[];for(let t=0;t<c;t++){let t=new ta(tv(e,0,32)),r=tp(e),i=tv(e,0,r),n=tp(e),s=tv(e,0,n);h.push({accountKey:t,writableIndexes:i,readonlyIndexes:s})}return new tS({header:n,staticAccountKeys:s,recentBlockhash:a,compiledInstructions:l,addressTableLookups:h})}}let tE={deserializeMessageVersion(t){let e=t[0],r=127&e;return r===e?"legacy":r},deserialize:t=>{let e=tE.deserializeMessageVersion(t);if("legacy"===e)return tk.from(t);if(0===e)return tS.deserialize(t);throw Error(`Transaction message version ${e} deserialization is not supported`)}},tM=((i={})[i.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",i[i.PROCESSED=1]="PROCESSED",i[i.TIMED_OUT=2]="TIMED_OUT",i[i.NONCE_INVALID=3]="NONCE_INVALID",i),tA=a.Buffer.alloc(64).fill(0);class tI{constructor(t){this.keys=void 0,this.programId=void 0,this.data=a.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 tx{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)return;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 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 tI(t))}),this}compileMessage(){let t,e,r;if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;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 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)r=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw Error(`Transaction instruction index ${t} has undefined program id`);let i=[],n=[];e.forEach(t=>{t.keys.forEach(t=>{n.push({...t})});let e=t.programId.toString();i.includes(e)||i.push(e)}),i.forEach(t=>{n.push({pubkey:new ta(t),isSigner:!1,isWritable:!1})});let s=[];n.forEach(t=>{let e=t.pubkey.toString(),r=s.findIndex(t=>t.pubkey.toString()===e);r>-1?(s[r].isWritable=s[r].isWritable||t.isWritable,s[r].isSigner=s[r].isSigner||t.isSigner):s.push(t)}),s.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"})});let o=s.findIndex(t=>t.pubkey.equals(r));if(o>-1){let[t]=s.splice(o,1);t.isSigner=!0,t.isWritable=!0,s.unshift(t)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let t of this.signatures){let e=s.findIndex(e=>e.pubkey.equals(t.publicKey));if(e>-1)s[e].isSigner||(s[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."));else throw Error(`unknown signer: ${t.publicKey.toString()}`)}let a=0,u=0,l=0,c=[],h=[];s.forEach(({pubkey:t,isSigner:e,isWritable:r})=>{e?(c.push(t.toString()),a+=1,r||(u+=1)):(h.push(t.toString()),r||(l+=1))});let d=c.concat(h),p=e.map(t=>{let{data:e,programId:r}=t;return{programIdIndex:d.indexOf(r.toString()),accounts:t.keys.map(t=>d.indexOf(t.pubkey.toString())),data:f().encode(e)}});return p.forEach(t=>{tm(t.programIdIndex>=0),t.accounts.forEach(t=>tm(t>=0))}),new tk({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:d,recentBlockhash:t,instructions:p})}_compile(){let 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))?t:(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 Error("No signers");let e=new Set;this.signatures=t.filter(t=>{let r=t.toString();return!e.has(r)&&(e.add(r),!0)}).map(t=>({signature:null,publicKey:t}))}sign(...t){if(0===t.length)throw Error("No signers");let e=new Set,r=[];for(let i of t){let t=i.publicKey.toString();e.has(t)||(e.add(t),r.push(i))}this.signatures=r.map(t=>({signature:null,publicKey:t.publicKey}));let i=this._compile();this._partialSign(i,...r)}partialSign(...t){if(0===t.length)throw Error("No signers");let e=new Set,r=[];for(let i of t){let t=i.publicKey.toString();e.has(t)||(e.add(t),r.push(i))}let i=this._compile();this._partialSign(i,...r)}_partialSign(t,...e){let r=t.serialize();e.forEach(t=>{let e=te(r,t.secretKey);this._addSignature(t.publicKey,ti(e))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){tm(64===e.length);let r=this.signatures.findIndex(e=>t.equals(e.publicKey));if(r<0)throw Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=a.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let r={};for(let{signature:i,publicKey:n}of this.signatures)null===i?e&&(r.missing||=[]).push(n):tr(i,t,n.toBytes())||(r.invalid||=[]).push(n);return r.invalid||r.missing?r:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),i=this.serializeMessage();if(r){let t=this._getMessageSignednessErrors(i,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+=`
|
|
2
2
|
Invalid signature for public key${1===t.invalid.length?"":"(s)"} [\`${t.invalid.map(t=>t.toBase58()).join("`, `")}\`].`),t.missing&&(e+=`
|
|
3
3
|
Missing signature for public key${1===t.missing.length?"":"(s)"} [\`${t.missing.map(t=>t.toBase58()).join("`, `")}\`].`),Error(e)}}return this._serialize(i)}_serialize(t){let{signatures:e}=this,r=[];tg(r,e.length);let i=r.length+64*e.length+t.length,n=a.Buffer.alloc(i);return tm(e.length<256),a.Buffer.from(r).copy(n,0),e.forEach(({signature:t},e)=>{null!==t&&(tm(64===t.length,"signature has invalid length"),a.Buffer.from(t).copy(n,r.length+64*e))}),t.copy(n,r.length+64*e.length),tm(n.length<=1232,`Transaction too large: ${n.length} > 1232`),n}get keys(){return tm(1===this.instructions.length),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return tm(1===this.instructions.length),this.instructions[0].programId}get data(){return tm(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t],r=tp(e),i=[];for(let t=0;t<r;t++){let t=tv(e,0,64);i.push(f().encode(a.Buffer.from(t)))}return tx.populate(tk.from(e),i)}static populate(t,e=[]){let r=new tx;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach((e,i)=>{let n={signature:e==f().encode(tA)?null:f().decode(e),publicKey:t.accountKeys[i]};r.signatures.push(n)}),t.instructions.forEach(e=>{let i=e.accounts.map(e=>{let i=t.accountKeys[e];return{pubkey:i,isSigner:r.signatures.some(t=>t.publicKey.toString()===i.toString())||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}});r.instructions.push(new tI({keys:i,programId:t.accountKeys[e.programIdIndex],data:f().decode(e.data)}))}),r._message=t,r._json=r.toJSON(),r}}class t_{get version(){return this.message.version}constructor(t,e){if(this.signatures=void 0,this.message=void 0,void 0!==e)tm(e.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=e;else{const e=[];for(let r=0;r<t.header.numRequiredSignatures;r++)e.push(new Uint8Array(64));this.signatures=e}this.message=t}serialize(){let t=this.message.serialize(),e=[];tg(e,this.signatures.length);let r=g.struct([g.blob(e.length,"encodedSignaturesLength"),g.seq(((t="signature")=>g.blob(64,t))(),this.signatures.length,"signatures"),g.blob(t.length,"serializedMessage")]),i=new Uint8Array(2048),n=r.encode({encodedSignaturesLength:new Uint8Array(e),signatures:this.signatures,serializedMessage:t},i);return i.slice(0,n)}static deserialize(t){let e=[...t],r=[],i=tp(e);for(let t=0;t<i;t++)r.push(new Uint8Array(tv(e,0,64)));return new t_(tE.deserialize(new Uint8Array(e)),r)}sign(t){let e=this.message.serialize(),r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let i of t){let t=r.findIndex(t=>t.equals(i.publicKey));tm(t>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[t]=te(e,i.secretKey)}}addSignature(t,e){tm(64===e.byteLength,"Signature must be 64 bytes long");let r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(e=>e.equals(t));tm(r>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[r]=e}}let tB=new ta("SysvarC1ock11111111111111111111111111111111");new ta("SysvarEpochSchedu1e111111111111111111111111"),new ta("Sysvar1nstructions1111111111111111111111111");let tT=new ta("SysvarRecentB1ockHashes11111111111111111111"),tC=new ta("SysvarRent111111111111111111111111111111111");new ta("SysvarRewards111111111111111111111111111111"),new ta("SysvarS1otHashes111111111111111111111111111"),new ta("SysvarS1otHistory11111111111111111111111111");let tR=new ta("SysvarStakeHistory1111111111111111111111111");class tP extends Error{constructor({action:t,signature:e,transactionMessage:r,logs:i}){let n;const s=i?`Logs:
|
|
4
4
|
${JSON.stringify(i.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";switch(t){case"send":n=`Transaction ${e} resulted in an error.
|
|
5
5
|
${r}. `+s+o;break;case"simulate":n=`Simulation failed.
|
|
6
6
|
Message: ${r}.
|
|
7
|
-
`+s+o;break;default:n=`Unknown action '${t}'`}super(n),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=r,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(null==t||"object"!=typeof t||!("then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,r)=>{t.getTransaction(this.signature).then(t=>{if(t&&t.meta&&t.meta.logMessages){let r=t.meta.logMessages;this.transactionLogs=r,e(r)}else r(Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}class tL extends Error{constructor({code:t,message:e,data:r},i){super(null!=i?`${i}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=r,this.name="SolanaJSONRPCError"}}async function tU(t,e,r,i){let n,s=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},o=await t.sendTransaction(e,r,s);if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)n=(await t.confirmTransaction({abortSignal:i?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},i&&i.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){let{nonceInstruction:r}=e.nonceInfo,s=r.keys[0].pubkey;n=(await t.confirmTransaction({abortSignal:i?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:s,nonceValue:e.nonceInfo.nonce,signature:o},i&&i.commitment)).value}else i?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),n=(await t.confirmTransaction(o,i&&i.commitment)).value;if(n.err){if(null!=o)throw new tP({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(n)})`});throw Error(`Transaction ${o} failed (${JSON.stringify(n)})`)}return o}function tO(t){return new Promise(e=>setTimeout(e,t))}function tW(t,e){let r=t.layout.span>=0?t.layout.span:function t(e,r){let i=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(r[e.property]);if("count"in e&&"elementLayout"in e){let t=r[e.property];if(Array.isArray(t))return t.length*i(e.elementLayout)}else if("fields"in e)return t({layout:e},r[e.property]);return 0},n=0;return e.layout.fields.forEach(t=>{n+=i(t)}),n}(t,e),i=a.Buffer.alloc(r),n=Object.assign({instruction:t.index},e);return t.layout.encode(n,i),i}let tz=g.nu64("lamportsPerSignature"),tN=g.struct([g.u32("version"),g.u32("state"),tf("authorizedPubkey"),tf("nonce"),g.struct([tz],"feeCalculator")]),tj=tN.span;class tK{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){let e=tN.decode(ti(t),0);return new tK({authorizedPubkey:new ta(e.authorizedPubkey),nonce:new ta(e.nonce).toString(),feeCalculator:e.feeCalculator})}}function tq(t){let e=(0,g.blob)(8,t),r=e.decode.bind(e),i=e.encode.bind(e),n=((t={})=>(function(t,e){if(w(t)!==w(e))throw new y(8078004);if(w(t)&&w(e)&&t.fixedSize!==e.fixedSize)throw new y(8078005,{decoderFixedSize:e.fixedSize,encoderFixedSize:t.fixedSize});if(!w(t)&&!w(e)&&t.maxSize!==e.maxSize)throw new y(8078006,{decoderMaxSize:e.maxSize,encoderMaxSize:t.maxSize});return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}})(((t={})=>{var e,r;return Object.freeze({...r={fixedSize:(e={config:t,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}).size,write(t,r,i){e.range&&function(t,e,r,i){if(i<e||i>r)throw new y(8078011,{codecDescription:t,max:r,min:e,value:i})}(e.name,e.range[0],e.range[1],t);let n=new ArrayBuffer(e.size);return e.set(new DataView(n),t,b(e.config)),r.set(new Uint8Array(n),i),i+e.size}},encode:t=>{let e=new Uint8Array("fixedSize"in r?r.fixedSize:r.getSizeFromValue(t));return r.write(t,e,0),e}})})(t),((t={})=>{var e,r;return Object.freeze({...r={fixedSize:(e={config:t,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}).size,read(t,r=0){var i,n,s;let o,a;!function(t,e,r=0){if(e.length-r<=0)throw new y(8078e3,{codecDescription:t})}(e.name,t,r),function(t,e,r,i=0){let n=r.length-i;if(n<e)throw new y(8078001,{bytesLength:n,codecDescription:t,expected:e})}(e.name,e.size,t,r);let u=new DataView((i=t,n=r,s=e.size,o=i.byteOffset+(n??0),a=s??i.byteLength,i.buffer.slice(o,o+a)));return[e.get(u,b(e.config)),r+e.size]}},decode:(t,e=0)=>r.read(t,e)[0]})})(t)))();return e.decode=(t,e)=>{let i=r(t,e);return n.decode(i)},e.encode=(t,e,r)=>i(n.encode(t),e,r),e}let tD=Object.freeze({Create:{index:0,layout:g.struct([g.u32("instruction"),g.ns64("lamports"),g.ns64("space"),tf("programId")])},Assign:{index:1,layout:g.struct([g.u32("instruction"),tf("programId")])},Transfer:{index:2,layout:g.struct([g.u32("instruction"),tq("lamports")])},CreateWithSeed:{index:3,layout:g.struct([g.u32("instruction"),tf("base"),td("seed"),g.ns64("lamports"),g.ns64("space"),tf("programId")])},AdvanceNonceAccount:{index:4,layout:g.struct([g.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:g.struct([g.u32("instruction"),tf("authorized")])},AuthorizeNonceAccount:{index:7,layout:g.struct([g.u32("instruction"),tf("authorized")])},Allocate:{index:8,layout:g.struct([g.u32("instruction"),g.ns64("space")])},AllocateWithSeed:{index:9,layout:g.struct([g.u32("instruction"),tf("base"),td("seed"),g.ns64("space"),tf("programId")])},AssignWithSeed:{index:10,layout:g.struct([g.u32("instruction"),tf("base"),td("seed"),tf("programId")])},TransferWithSeed:{index:11,layout:g.struct([g.u32("instruction"),tq("lamports"),td("seed"),tf("programId")])},UpgradeNonceAccount:{index:12,layout:g.struct([g.u32("instruction")])}});class t${constructor(){}static createAccount(t){let e=tW(tD.Create,{lamports:t.lamports,space:t.space,programId:ti(t.programId.toBuffer())});return new tI({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=tW(tD.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:ti(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=tW(tD.Transfer,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new tI({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;return"basePubkey"in t?(e=tW(tD.AssignWithSeed,{base:ti(t.basePubkey.toBuffer()),seed:t.seed,programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=tW(tD.Assign,{programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tI({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=tW(tD.CreateWithSeed,{base:ti(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||r.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new tI({keys:r,programId:this.programId,data:e})}static createNonceAccount(t){let e=new tx;"basePubkey"in t&&"seed"in t?e.add(t$.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:tj,programId:this.programId})):e.add(t$.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:tj,programId:this.programId}));let r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){let e=tW(tD.InitializeNonceAccount,{authorized:ti(t.authorizedPubkey.toBuffer())});return new tI({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tT,isSigner:!1,isWritable:!1},{pubkey:tC,isSigner:!1,isWritable:!1}],programId:this.programId,data:e})}static nonceAdvance(t){let e=tW(tD.AdvanceNonceAccount);return new tI({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tT,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceWithdraw(t){let e=tW(tD.WithdrawNonceAccount,{lamports:t.lamports});return new tI({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:tT,isSigner:!1,isWritable:!1},{pubkey:tC,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){let e=tW(tD.AuthorizeNonceAccount,{authorized:ti(t.newAuthorizedPubkey.toBuffer())});return new tI({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=tW(tD.AllocateWithSeed,{base:ti(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=tW(tD.Allocate,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tI({keys:r,programId:this.programId,data:e})}}t$.programId=new ta("11111111111111111111111111111111");class tF{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/tF.chunkSize)+1+1)}static async load(t,e,r,i,n){{let s=await t.getMinimumBalanceForRentExemption(n.length),o=await t.getAccountInfo(r.publicKey,"confirmed"),a=null;if(null!==o){if(o.executable)return console.error("Program load failed, account is already executable"),!1;o.data.length!==n.length&&(a=a||new tx).add(t$.allocate({accountPubkey:r.publicKey,space:n.length})),o.owner.equals(i)||(a=a||new tx).add(t$.assign({accountPubkey:r.publicKey,programId:i})),o.lamports<s&&(a=a||new tx).add(t$.transfer({fromPubkey:e.publicKey,toPubkey:r.publicKey,lamports:s-o.lamports}))}else a=new tx().add(t$.createAccount({fromPubkey:e.publicKey,newAccountPubkey:r.publicKey,lamports:s>0?s:1,space:n.length,programId:i}));null!==a&&await tU(t,a,[e,r],{commitment:"confirmed"})}let s=g.struct([g.u32("instruction"),g.u32("offset"),g.u32("bytesLength"),g.u32("bytesLengthPadding"),g.seq(g.u8("byte"),g.offset(g.u32(),-8),"bytes")]),o=tF.chunkSize,u=0,l=n,c=[];for(;l.length>0;){let n=l.slice(0,o),h=a.Buffer.alloc(o+16);s.encode({instruction:0,offset:u,bytes:n,bytesLength:0,bytesLengthPadding:0},h);let f=new tx().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:h});c.push(tU(t,f,[e,r],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await tO(250),u+=o,l=l.slice(o)}await Promise.all(c);{let n=g.struct([g.u32("instruction")]),s=a.Buffer.alloc(n.span);n.encode({instruction:1},s);let o=new tx().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:tC,isSigner:!1,isWritable:!1}],programId:i,data:s}),u="processed",l=await t.sendTransaction(o,[e,r],{preflightCommitment:u}),{context:c,value:h}=await t.confirmTransaction({signature:l,lastValidBlockHeight:o.lastValidBlockHeight,blockhash:o.recentBlockhash},u);if(h.err)throw Error(`Transaction ${l} failed (${JSON.stringify(h)})`);for(;;){try{if(await t.getSlot({commitment:u})>c.slot)break}catch{}await new Promise(t=>setTimeout(t,Math.round(200)))}}return!0}}tF.chunkSize=932,new ta("BPFLoader2111111111111111111111111111111111");var tH=(n=function(){if(o)return s;o=1;var t=Object.prototype.toString,e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};return s=function(r){var i=function r(i,n){var s,o,a,u,l,c,h;if(!0===i)return"true";if(!1===i)return"false";switch(typeof i){case"object":if(null===i)return null;if(i.toJSON&&"function"==typeof i.toJSON)return r(i.toJSON(),n);if("[object Array]"===(h=t.call(i))){for(s=0,a="[",o=i.length-1;s<o;s++)a+=r(i[s],!0)+",";return o>-1&&(a+=r(i[s],!0)),a+"]"}if("[object Object]"!==h)return JSON.stringify(i);for(o=(u=e(i).sort()).length,a="",s=0;s<o;)void 0!==(c=r(i[l=u[s]],!1))&&(a&&(a+=","),a+=JSON.stringify(l)+":"+c),s++;return"{"+a+"}";case"function":case"undefined":return n?null:void 0;case"string":return JSON.stringify(i);default:return isFinite(i)?i:null}}(r,!1);if(void 0!==i)return""+i}}())&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;function tV(t){let e=0;for(;t>1;)t/=2,e++;return e}class tJ{constructor(t,e,r,i,n){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=n}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){var e;let r=tV(0===(e=t+32+1)?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,(e|=e>>32)+1))-tV(32)-1,i=this.getSlotsInEpoch(r);return[r,t-(i-32)]}{let e=t-this.firstNormalSlot,r=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+r,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?(Math.pow(2,t)-1)*32:(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+tV(32)):this.slotsPerEpoch}}var tY=globalThis.fetch;class tZ extends Y{constructor(t,e,r){super(t=>{let r=new V(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return"socket"in r?this.underlyingSocket=r.socket:this.underlyingSocket=r,r},t,e,r),this.underlyingSocket=void 0}call(...t){let e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){let e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class tG{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){let t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){let e=function(t,e){let r;try{r=t.layout.decode(e)}catch(t){throw Error("invalid instruction; "+t)}if(r.typeIndex!==t.index)throw Error(`invalid account data; account type mismatch ${r.typeIndex} != ${t.index}`);return r}(tQ,t),r=t.length-56;tm(r>=0,"lookup table is invalid"),tm(r%32==0,"lookup table is invalid");let{addresses:i}=g.struct([g.seq(tf(),r/32,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new ta(e.authority[0]):void 0,addresses:i.map(t=>new ta(t))}}}let tQ={index:1,layout:g.struct([g.u32("typeIndex"),tq("deactivationSlot"),g.nu64("lastExtendedSlot"),g.u8("lastExtendedStartIndex"),g.u8(),g.seq(tf(),g.offset(g.u8(),-1),"authority")])},tX=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,t0=D(R(ta),z(),t=>new ta(t)),t1=N([z(),P("base64")]),t2=D(R(a.Buffer),t1,t=>a.Buffer.from(t[0],"base64"));function t6(t){let e,r;if("string"==typeof t)e=t;else if(t){let{commitment:i,...n}=t;e=i,r=n}return{commitment:e,config:r}}function t3(t){return t.map(t=>"memcmp"in t?{...t,memcmp:{...t.memcmp,encoding:t.memcmp.encoding??"base58"}}:t)}function t8(t){return K([j({jsonrpc:P("2.0"),id:z(),result:t}),j({jsonrpc:P("2.0"),id:z(),error:j({code:q(),message:z(),data:O(B("any",()=>!0))})})])}let t5=t8(q());function t4(t){return D(t8(t),t5,e=>"error"in e?e:{...e,result:x(e.result,t)})}function t9(t){return t4(j({context:j({slot:U()}),value:t}))}function t7(t){return j({context:j({slot:U()}),value:t})}function et(t,e){return 0===t?new tS({header:e.header,staticAccountKeys:e.accountKeys.map(t=>new ta(t)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:f().decode(t.data)})),addressTableLookups:e.addressTableLookups}):new tk(e)}let ee=j({foundation:U(),foundationTerm:U(),initial:U(),taper:U(),terminal:U()}),er=t4(T(L(j({epoch:U(),effectiveSlot:U(),amount:U(),postBalance:U(),commission:O(L(U()))})))),ei=T(j({slot:U(),prioritizationFee:U()})),en=j({total:U(),validator:U(),foundation:U(),epoch:U()}),es=j({epoch:U(),slotIndex:U(),slotsInEpoch:U(),absoluteSlot:U(),blockHeight:O(U()),transactionCount:O(U())}),eo=j({slotsPerEpoch:U(),leaderScheduleSlotOffset:U(),warmup:C(),firstNormalEpoch:U(),firstNormalSlot:U()}),ea=W(z(),T(U())),eu=L(K([j({}),z()])),el=j({err:eu}),ec=P("receivedSignature"),eh=j({"solana-core":z(),"feature-set":O(U())}),ef=j({program:z(),programId:t0,parsed:q()}),ed=j({programId:t0,accounts:T(t0),data:z()}),ep=t9(j({err:L(K([j({}),z()])),logs:L(T(z())),accounts:O(L(T(L(j({executable:C(),owner:z(),lamports:U(),data:T(z()),rentEpoch:O(U())}))))),unitsConsumed:O(U()),returnData:O(L(j({programId:z(),data:N([z(),P("base64")])}))),innerInstructions:O(L(T(j({index:U(),instructions:T(K([ef,ed]))}))))})),eg=t9(j({byIdentity:W(z(),T(U())),range:j({firstSlot:U(),lastSlot:U()})})),em=t4(ee),ey=t4(en),ew=t4(ei),eb=t4(es),ev=t4(eo),ek=t4(ea),eS=t4(U()),eE=t9(j({total:U(),circulating:U(),nonCirculating:U(),nonCirculatingAccounts:T(t0)})),eM=j({amount:z(),uiAmount:L(U()),decimals:U(),uiAmountString:O(z())}),eA=t9(T(j({address:t0,amount:z(),uiAmount:L(U()),decimals:U(),uiAmountString:O(z())}))),eI=t9(T(j({pubkey:t0,account:j({executable:C(),owner:t0,lamports:U(),data:t2,rentEpoch:U()})}))),ex=j({program:z(),parsed:q(),space:U()}),e_=t9(T(j({pubkey:t0,account:j({executable:C(),owner:t0,lamports:U(),data:ex,rentEpoch:U()})}))),eB=t9(T(j({lamports:U(),address:t0}))),eT=j({executable:C(),owner:t0,lamports:U(),data:t2,rentEpoch:U()}),eC=j({pubkey:t0,account:eT}),eR=D(K([R(a.Buffer),ex]),K([t1,ex]),t=>Array.isArray(t)?x(t,t2):t),eP=j({executable:C(),owner:t0,lamports:U(),data:eR,rentEpoch:U()}),eL=j({pubkey:t0,account:eP}),eU=j({state:K([P("active"),P("inactive"),P("activating"),P("deactivating")]),active:U(),inactive:U()}),eO=t4(T(j({signature:z(),slot:U(),err:eu,memo:L(z()),blockTime:O(L(U()))}))),eW=t4(T(j({signature:z(),slot:U(),err:eu,memo:L(z()),blockTime:O(L(U()))}))),ez=j({subscription:U(),result:t7(eT)}),eN=j({pubkey:t0,account:eT}),ej=j({subscription:U(),result:t7(eN)}),eK=j({parent:U(),slot:U(),root:U()}),eq=j({subscription:U(),result:eK}),eD=K([j({type:K([P("firstShredReceived"),P("completed"),P("optimisticConfirmation"),P("root")]),slot:U(),timestamp:U()}),j({type:P("createdBank"),parent:U(),slot:U(),timestamp:U()}),j({type:P("frozen"),slot:U(),timestamp:U(),stats:j({numTransactionEntries:U(),numSuccessfulTransactions:U(),numFailedTransactions:U(),maxTransactionsPerEntry:U()})}),j({type:P("dead"),slot:U(),timestamp:U(),err:z()})]),e$=j({subscription:U(),result:eD}),eF=j({subscription:U(),result:t7(K([el,ec]))}),eH=j({subscription:U(),result:U()}),eV=j({pubkey:z(),gossip:L(z()),tpu:L(z()),rpc:L(z()),version:L(z())}),eJ=j({votePubkey:z(),nodePubkey:z(),activatedStake:U(),epochVoteAccount:C(),epochCredits:T(N([U(),U(),U()])),commission:U(),lastVote:U(),rootSlot:L(U())}),eY=t4(j({current:T(eJ),delinquent:T(eJ)})),eZ=K([P("processed"),P("confirmed"),P("finalized")]),eG=j({slot:U(),confirmations:L(U()),err:eu,confirmationStatus:O(eZ)}),eQ=t9(T(L(eG))),eX=t4(U()),e0=j({accountKey:t0,writableIndexes:T(U()),readonlyIndexes:T(U())}),e1=j({signatures:T(z()),message:j({accountKeys:T(z()),header:j({numRequiredSignatures:U(),numReadonlySignedAccounts:U(),numReadonlyUnsignedAccounts:U()}),instructions:T(j({accounts:T(U()),data:z(),programIdIndex:U()})),recentBlockhash:z(),addressTableLookups:O(T(e0))})}),e2=j({pubkey:t0,signer:C(),writable:C(),source:O(K([P("transaction"),P("lookupTable")]))}),e6=j({accountKeys:T(e2),signatures:T(z())}),e3=j({parsed:q(),program:z(),programId:t0}),e8=j({accounts:T(t0),data:z(),programId:t0}),e5=D(K([e8,e3]),K([j({parsed:q(),program:z(),programId:z()}),j({accounts:T(z()),data:z(),programId:z()})]),t=>"accounts"in t?x(t,e8):x(t,e3)),e4=j({signatures:T(z()),message:j({accountKeys:T(e2),instructions:T(e5),recentBlockhash:z(),addressTableLookups:O(L(T(e0)))})}),e9=j({accountIndex:U(),mint:z(),owner:O(z()),programId:O(z()),uiTokenAmount:eM}),e7=j({writable:T(t0),readonly:T(t0)}),rt=j({err:eu,fee:U(),innerInstructions:O(L(T(j({index:U(),instructions:T(j({accounts:T(U()),data:z(),programIdIndex:U()}))})))),preBalances:T(U()),postBalances:T(U()),logMessages:O(L(T(z()))),preTokenBalances:O(L(T(e9))),postTokenBalances:O(L(T(e9))),loadedAddresses:O(e7),computeUnitsConsumed:O(U()),costUnits:O(U())}),re=j({err:eu,fee:U(),innerInstructions:O(L(T(j({index:U(),instructions:T(e5)})))),preBalances:T(U()),postBalances:T(U()),logMessages:O(L(T(z()))),preTokenBalances:O(L(T(e9))),postTokenBalances:O(L(T(e9))),loadedAddresses:O(e7),computeUnitsConsumed:O(U()),costUnits:O(U())}),rr=K([P(0),P("legacy")]),ri=j({pubkey:z(),lamports:U(),postBalance:L(U()),rewardType:L(z()),commission:O(L(U()))}),rn=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e1,meta:L(rt),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),rs=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),ro=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e6,meta:L(rt),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),ra=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e4,meta:L(re),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),ru=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e6,meta:L(re),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),rl=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),rc=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e1,meta:L(rt)})),rewards:O(T(ri)),blockTime:L(U())}))),rh=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),signatures:T(z()),blockTime:L(U())}))),rf=t4(L(j({slot:U(),meta:L(rt),blockTime:O(L(U())),transaction:e1,version:O(rr)}))),rd=t4(L(j({slot:U(),transaction:e4,meta:L(re),blockTime:O(L(U())),version:O(rr)}))),rp=t9(j({blockhash:z(),lastValidBlockHeight:U()})),rg=t9(C()),rm=t4(T(j({slot:U(),numTransactions:U(),numSlots:U(),samplePeriodSecs:U()}))),ry=t9(L(j({feeCalculator:j({lamportsPerSignature:U()})}))),rw=t4(z()),rb=t4(z()),rv=j({err:eu,logs:T(z()),signature:z()}),rk=j({result:t7(rv),subscription:U()}),rS={"solana-client":"js/1.0.0-maintenance"};class rE{constructor(t,e){var r;let i,n,s,o,a,u;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{let t={};return async e=>{let{commitment:r,config:i}=t6(e),n=this._buildArgs([],r,void 0,i),s=tH(n);return t[s]=t[s]??(async()=>{try{let t=await this._rpcRequest("getBlockHeight",n),e=x(t,t4(U()));if("error"in e)throw new tL(e.error,"failed to get block height information");return e.result}finally{delete t[s]}})(),await t[s]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,i=e.wsEndpoint,n=e.httpHeaders,s=e.fetch,o=e.fetchMiddleware,a=e.disableRetryOnRateLimit,u=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=i||function(t){let e=t.match(tX);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);let[r,i,n,s]=e,o=t.startsWith("https:")?"wss:":"ws:",a=null==n?null:parseInt(n.slice(1),10),u=null==a?"":`:${a+1}`;return`${o}//${i}${u}${s}`}(t),this._rpcClient=function(t,e,r,i,n,s){let o,a,u=r||tY;return null!=s&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),i&&(a=async(t,e)=>{let r=await new Promise((r,n)=>{try{i(t,e,(t,e)=>r([t,e]))}catch(t){n(t)}});return await u(...r)}),new(F())(async(r,i)=>{let s={method:"POST",body:r,agent:o,headers:Object.assign({"Content-Type":"application/json"},e||{},rS)};try{let e,r=5,o=500;for(;(e=a?await a(t,s):await u(t,s),429===e.status&&!0!==n)&&(r-=1,0!==r);){;console.error(`Server responded with ${e.status} ${e.statusText}. Retrying after ${o}ms delay...`),await tO(o),o*=2}let l=await e.text();e.ok?i(null,l):i(Error(`${e.status} ${e.statusText}: ${l}`))}catch(t){t instanceof Error&&i(t)}},{})}(t,n,s,o,a,u),this._rpcRequest=(r=this._rpcClient,(t,e)=>new Promise((i,n)=>{r.request(t,e,(t,e)=>{t?n(t):i(e)})})),this._rpcBatchRequest=function(t){return e=>new Promise((r,i)=>{0===e.length&&r([]);let n=e.map(e=>t.request(e.methodName,e.args));t.request(n,(t,e)=>{t?i(t):r(e)})})}(this._rpcClient),this._rpcWebSocket=new tZ(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,void 0,i),s=x(await this._rpcRequest("getBalance",n),t9(U()));if("error"in s)throw new tL(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then(t=>t.value).catch(e=>{throw Error("failed to get balance of account "+t.toBase58()+": "+e)})}async getBlockTime(t){let e=x(await this._rpcRequest("getBlockTime",[t]),t4(L(U())));if("error"in e)throw new tL(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){let t=x(await this._rpcRequest("minimumLedgerSlot",[]),t4(U()));if("error"in t)throw new tL(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){let t=x(await this._rpcRequest("getFirstAvailableBlock",[]),eS);if("error"in t)throw new tL(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};let r=x(await this._rpcRequest("getSupply",[e]),eE);if("error"in r)throw new tL(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){let r=this._buildArgs([t.toBase58()],e),i=x(await this._rpcRequest("getTokenSupply",r),t9(eM));if("error"in i)throw new tL(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){let r=this._buildArgs([t.toBase58()],e),i=x(await this._rpcRequest("getTokenAccountBalance",r),t9(eM));if("error"in i)throw new tL(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,r){let{commitment:i,config:n}=t6(r),s=[t.toBase58()];"mint"in e?s.push({mint:e.mint.toBase58()}):s.push({programId:e.programId.toBase58()});let o=this._buildArgs(s,i,"base64",n),a=x(await this._rpcRequest("getTokenAccountsByOwner",o),eI);if("error"in a)throw new tL(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(t,e,r){let i=[t.toBase58()];"mint"in e?i.push({mint:e.mint.toBase58()}):i.push({programId:e.programId.toBase58()});let n=this._buildArgs(i,r,"jsonParsed"),s=x(await this._rpcRequest("getTokenAccountsByOwner",n),e_);if("error"in s)throw new tL(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){let e={...t,commitment:t&&t.commitment||this.commitment},r=e.filter||e.commitment?[e]:[],i=x(await this._rpcRequest("getLargestAccounts",r),eB);if("error"in i)throw new tL(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){let r=this._buildArgs([t.toBase58()],e),i=x(await this._rpcRequest("getTokenLargestAccounts",r),eA);if("error"in i)throw new tL(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,"base64",i),s=x(await this._rpcRequest("getAccountInfo",n),t9(L(eT)));if("error"in s)throw new tL(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,"jsonParsed",i),s=x(await this._rpcRequest("getAccountInfo",n),t9(L(eP)));if("error"in s)throw new tL(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>t.toBase58()),s=this._buildArgs([n],r,"jsonParsed",i),o=x(await this._rpcRequest("getMultipleAccounts",s),t9(T(L(eP))));if("error"in o)throw new tL(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfoAndContext(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>t.toBase58()),s=this._buildArgs([n],r,"base64",i),o=x(await this._rpcRequest("getMultipleAccounts",s),t9(T(L(eT))));if("error"in o)throw new tL(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,r){let{commitment:i,config:n}=t6(e),s=this._buildArgs([t.toBase58()],i,void 0,{...n,epoch:null!=r?r:n?.epoch}),o=x(await this._rpcRequest("getStakeActivation",s),t4(eU));if("error"in o)throw new tL(o.error,`failed to get Stake Activation ${t.toBase58()}`);return o.result}async getProgramAccounts(t,e){let{commitment:r,config:i}=t6(e),{encoding:n,...s}=i||{},o=this._buildArgs([t.toBase58()],r,n||"base64",{...s,...s.filters?{filters:t3(s.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",o),u=T(eC),l=!0===s.withContext?x(a,t9(u)):x(a,t4(u));if("error"in l)throw new tL(l.error,`failed to get accounts owned by program ${t.toBase58()}`);return l.result}async getParsedProgramAccounts(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,"jsonParsed",i),s=x(await this._rpcRequest("getProgramAccounts",n),t4(T(eL)));if("error"in s)throw new tL(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let r,i;if("string"==typeof t)r=t;else{if(t.abortSignal?.aborted)return Promise.reject(t.abortSignal.reason);r=t.signature}try{i=f().decode(r)}catch(t){throw Error("signature must be base58 encoded: "+r)}return(tm(64===i.length,"signature has invalid length"),"string"==typeof t)?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:r}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise((e,r)=>{null!=t&&(t.aborted?r(t.reason):t.addEventListener("abort",()=>{r(t.reason)}))})}getTransactionConfirmationPromise({commitment:t,signature:e}){let r,i,n=!1;return{abortConfirmation:()=>{i&&(i(),i=void 0),null!=r&&(this.removeSignatureListener(r),r=void 0)},confirmationPromise:new Promise((s,o)=>{try{r=this.onSignature(e,(t,e)=>{r=void 0,s({__type:tM.PROCESSED,response:{context:e,value:t}})},t);let a=new Promise(t=>{null==r?t():i=this._onSubscriptionStateChange(r,e=>{"subscribed"===e&&t()})});(async()=>{if(await a,n)return;let r=await this.getSignatureStatus(e);if(n||null==r)return;let{context:i,value:u}=r;if(null!=u)if(u?.err)o(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}n=!0,s({__type:tM.PROCESSED,response:{context:i,value:u}})}})()}catch(t){o(t)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:r,signature:i}}){let n,s=!1,o=new Promise(e=>{let i=async()=>{try{return await this.getBlockHeight(t)}catch(t){return -1}};(async()=>{let t=await i();if(!s){for(;t<=r;)if(await tO(1e3),s||(t=await i(),s))return;e({__type:tM.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),l=this.getCancellationPromise(e);try{let t=await Promise.race([l,u,o]);if(t.__type===tM.PROCESSED)n=t.response;else throw new tu(i)}finally{s=!0,a()}return n}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:r,nonceAccountPubkey:i,nonceValue:n,signature:s}}){let o,a=!1,u=new Promise(e=>{let s=n,o=null,u=async()=>{try{let{context:e,value:n}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:r});return o=e.slot,n?.nonce}catch(t){return s}};(async()=>{if(s=await u(),!a)for(;;){if(n!==s)return void e({__type:tM.NONCE_INVALID,slotInWhichNonceDidAdvance:o});if(await tO(2e3),a||(s=await u(),a))return}})()}),{abortConfirmation:l,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:s}),h=this.getCancellationPromise(e);try{let e=await Promise.race([h,c,u]);if(e.__type===tM.PROCESSED)o=e.response;else{let i;for(;;){let t=await this.getSignatureStatus(s);if(null==t)break;if(t.context.slot<(e.slotInWhichNonceDidAdvance??r)){await tO(400);continue}i=t;break}if(i?.value){let e=t||"finalized",{confirmationStatus:r}=i.value;switch(e){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new tc(s);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new tc(s);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new tc(s)}o={context:i.context,value:{err:i.value.err}}}else throw new tc(s)}}finally{a=!0,l()}return o}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let r,i,n=new Promise(e=>{let i=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":i=this._confirmTransactionInitialTimeout||3e4}r=setTimeout(()=>e({__type:tM.TIMED_OUT,timeoutMs:i}),i)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});try{let t=await Promise.race([o,n]);if(t.__type===tM.PROCESSED)i=t.response;else throw new tl(e,t.timeoutMs/1e3)}finally{clearTimeout(r),s()}return i}async getClusterNodes(){let t=x(await this._rpcRequest("getClusterNodes",[]),t4(T(eV)));if("error"in t)throw new tL(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){let e=this._buildArgs([],t),r=x(await this._rpcRequest("getVoteAccounts",e),eY);if("error"in r)throw new tL(r.error,"failed to get vote accounts");return r.result}async getSlot(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getSlot",i),t4(U()));if("error"in n)throw new tL(n.error,"failed to get slot");return n.result}async getSlotLeader(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getSlotLeader",i),t4(z()));if("error"in n)throw new tL(n.error,"failed to get slot leader");return n.result}async getSlotLeaders(t,e){let r=x(await this._rpcRequest("getSlotLeaders",[t,e]),t4(T(t0)));if("error"in r)throw new tL(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){let{context:r,value:i}=await this.getSignatureStatuses([t],e);return tm(1===i.length),{context:r,value:i[0]}}async getSignatureStatuses(t,e){let r=[t];e&&r.push(e);let i=x(await this._rpcRequest("getSignatureStatuses",r),eQ);if("error"in i)throw new tL(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getTransactionCount",i),t4(U()));if("error"in n)throw new tL(n.error,"failed to get transaction count");return n.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){let e=this._buildArgs([],t),r=x(await this._rpcRequest("getInflationGovernor",e),em);if("error"in r)throw new tL(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,r){let{commitment:i,config:n}=t6(r),s=this._buildArgs([t.map(t=>t.toBase58())],i,void 0,{...n,epoch:null!=e?e:n?.epoch}),o=x(await this._rpcRequest("getInflationReward",s),er);if("error"in o)throw new tL(o.error,"failed to get inflation reward");return o.result}async getInflationRate(){let t=x(await this._rpcRequest("getInflationRate",[]),ey);if("error"in t)throw new tL(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getEpochInfo",i),eb);if("error"in n)throw new tL(n.error,"failed to get epoch info");return n.result}async getEpochSchedule(){let t=x(await this._rpcRequest("getEpochSchedule",[]),ev);if("error"in t)throw new tL(t.error,"failed to get epoch schedule");let e=t.result;return new tJ(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){let t=x(await this._rpcRequest("getLeaderSchedule",[]),ek);if("error"in t)throw new tL(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){let r=this._buildArgs([t],e),i=x(await this._rpcRequest("getMinimumBalanceForRentExemption",r),eX);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){let{context:e,value:{blockhash:r}}=await this.getLatestBlockhashAndContext(t);return{context:e,value:{blockhash:r,feeCalculator:{get lamportsPerSignature(){throw Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(t){let e=x(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),rm);if("error"in e)throw new tL(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){let r=this._buildArgs([t],e),i=x(await this._rpcRequest("getFeeCalculatorForBlockhash",r),ry);if("error"in i)throw new tL(i.error,"failed to get fee calculator");let{context:n,value:s}=i.result;return{context:n,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){let r=ti(t.serialize()).toString("base64"),i=this._buildArgs([r],e),n=x(await this._rpcRequest("getFeeForMessage",i),t9(L(U())));if("error"in n)throw new tL(n.error,"failed to get fee for message");if(null===n.result)throw Error("invalid blockhash");return n.result}async getRecentPrioritizationFees(t){let e=t?.lockedWritableAccounts?.map(t=>t.toBase58()),r=e?.length?[e]:[],i=x(await this._rpcRequest("getRecentPrioritizationFees",r),ew);if("error"in i)throw new tL(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getLatestBlockhash",i),rp);if("error"in n)throw new tL(n.error,"failed to get latest blockhash");return n.result}async isBlockhashValid(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t],r,void 0,i),s=x(await this._rpcRequest("isBlockhashValid",n),rg);if("error"in s)throw new tL(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){let t=x(await this._rpcRequest("getVersion",[]),t4(eh));if("error"in t)throw new tL(t.error,"failed to get version");return t.result}async getGenesisHash(){let t=x(await this._rpcRequest("getGenesisHash",[]),t4(z()));if("error"in t)throw new tL(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,void 0,i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let t=x(s,ro);if("error"in t)throw t.error;return t.result}case"none":{let t=x(s,rs);if("error"in t)throw t.error;return t.result}default:{let t=x(s,rn);if("error"in t)throw t.error;let{result:e}=t;return e?{...e,transactions:e.transactions.map(({transaction:t,meta:e,version:r})=>({meta:e,transaction:{...t,message:et(r,t.message)},version:r}))}:null}}}catch(t){throw new tL(t,"failed to get confirmed block")}}async getParsedBlock(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let t=x(s,ru);if("error"in t)throw t.error;return t.result}case"none":{let t=x(s,rl);if("error"in t)throw t.error;return t.result}default:{let t=x(s,ra);if("error"in t)throw t.error;return t.result}}}catch(t){throw new tL(t,"failed to get block")}}async getBlockProduction(t){let e,r;if("string"==typeof t)r=t;else if(t){let{commitment:i,...n}=t;r=i,e=n}let i=this._buildArgs([],r,"base64",e),n=x(await this._rpcRequest("getBlockProduction",i),eg);if("error"in n)throw new tL(n.error,"failed to get block production information");return n.result}async getTransaction(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,void 0,i),s=x(await this._rpcRequest("getTransaction",n),rf);if("error"in s)throw new tL(s.error,"failed to get transaction");let o=s.result;return o?{...o,transaction:{...o.transaction,message:et(o.version,o.transaction.message)}}:o}async getParsedTransaction(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),s=x(await this._rpcRequest("getTransaction",n),rd);if("error"in s)throw new tL(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i)}));return(await this._rpcBatchRequest(n)).map(t=>{let e=x(t,rd);if("error"in e)throw new tL(e.error,"failed to get transactions");return e.result})}async getTransactions(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,void 0,i)}));return(await this._rpcBatchRequest(n)).map(t=>{let e=x(t,rf);if("error"in e)throw new tL(e.error,"failed to get transactions");let r=e.result;return r?{...r,transaction:{...r.transaction,message:et(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=x(await this._rpcRequest("getBlock",r),rc);if("error"in i)throw new tL(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+t+" not found");let s={...n,transactions:n.transactions.map(({transaction:t,meta:e})=>{let r=new tk(t.message);return{meta:e,transaction:{...t,message:r}}})};return{...s,transactions:s.transactions.map(({transaction:t,meta:e})=>({meta:e,transaction:tx.populate(t.message,t.signatures)}))}}async getBlocks(t,e,r){let i=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],r),n=x(await this._rpcRequest("getBlocks",i),t4(T(U())));if("error"in n)throw new tL(n.error,"failed to get blocks");return n.result}async getBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=x(await this._rpcRequest("getBlock",r),rh);if("error"in i)throw new tL(i.error,"failed to get block");let n=i.result;if(!n)throw Error("Block "+t+" not found");return n}async getConfirmedBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=x(await this._rpcRequest("getBlock",r),rh);if("error"in i)throw new tL(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+t+" not found");return n}async getConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=x(await this._rpcRequest("getTransaction",r),rf);if("error"in i)throw new tL(i.error,"failed to get transaction");let n=i.result;if(!n)return n;let s=new tk(n.transaction.message),o=n.transaction.signatures;return{...n,transaction:tx.populate(s,o)}}async getParsedConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),i=x(await this._rpcRequest("getTransaction",r),rd);if("error"in i)throw new tL(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){let r=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(t=>{let e=x(t,rd);if("error"in e)throw new tL(e.error,"failed to get confirmed transactions");return e.result})}async getConfirmedSignaturesForAddress(t,e,r){let i={},n=await this.getFirstAvailableBlock();for(;!("until"in i)&&!(--e<=0)&&!(e<n);)try{let t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(i.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let s=await this.getSlot("finalized");for(;!("before"in i)&&!(++r>s);)try{let t=await this.getConfirmedBlockSignatures(r);t.signatures.length>0&&(i.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,i)).map(t=>t.signature)}async getConfirmedSignaturesForAddress2(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),n=x(await this._rpcRequest("getConfirmedSignaturesForAddress2",i),eO);if("error"in n)throw new tL(n.error,"failed to get confirmed signatures for address");return n.result}async getSignaturesForAddress(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),n=x(await this._rpcRequest("getSignaturesForAddress",i),eW);if("error"in n)throw new tL(n.error,"failed to get signatures for address");return n.result}async getAddressLookupTable(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),n=null;return null!==i&&(n=new tG({key:t,state:tG.deserialize(i.data)})),{context:r,value:n}}async getNonceAndContext(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),n=null;return null!==i&&(n=tK.fromAccountData(i.data)),{context:r,value:n}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then(t=>t.value).catch(e=>{throw Error("failed to get nonce for account "+t.toBase58()+": "+e)})}async requestAirdrop(t,e){let r=x(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),rw);if("error"in r)throw new tL(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await tO(100);let t=Date.now()-this._blockhashInfo.lastFetch;if(null!==this._blockhashInfo.latestBlockhash&&!(t>=3e4))return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let t=Date.now(),e=this._blockhashInfo.latestBlockhash,r=e?e.blockhash:null;for(let t=0;t<50;t++){let t=await this.getLatestBlockhash("finalized");if(r!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await tO(200)}throw Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,"base64",r),n=x(await this._rpcRequest("getStakeMinimumDelegation",i),t9(U()));if("error"in n)throw new tL(n.error,"failed to get stake minimum delegation");return n.result}async simulateTransaction(t,e,r){let i;if("message"in t){let i=t.serialize(),n=a.Buffer.from(i).toString("base64");if(Array.isArray(e)||void 0!==r)throw Error("Invalid arguments");let s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment),e&&"object"==typeof e&&"innerInstructions"in e&&(s.innerInstructions=e.innerInstructions);let o=[n,s],u=x(await this._rpcRequest("simulateTransaction",o),ep);if("error"in u)throw Error("failed to simulate transaction: "+u.error.message);return u.result}if(t instanceof tx?((i=new tx).feePayer=t.feePayer,i.instructions=t.instructions,i.nonceInfo=t.nonceInfo,i.signatures=t.signatures):(i=tx.populate(t))._message=i._json=void 0,void 0!==e&&!Array.isArray(e))throw Error("Invalid arguments");if(i.nonceInfo&&e)i.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){let r=await this._blockhashWithExpiryBlockHeight(t);if(i.lastValidBlockHeight=r.lastValidBlockHeight,i.recentBlockhash=r.blockhash,!e)break;if(i.sign(...e),!i.signature)throw Error("!signature");let n=i.signature.toString("base64");if(this._blockhashInfo.simulatedSignatures.includes(n)||this._blockhashInfo.transactionSignatures.includes(n))t=!0;else{this._blockhashInfo.simulatedSignatures.push(n);break}}}let n=i._compile(),s=n.serialize(),o=i._serialize(s).toString("base64"),u={encoding:"base64",commitment:this.commitment};r&&(u.accounts={encoding:"base64",addresses:(Array.isArray(r)?r:n.nonProgramIds()).map(t=>t.toBase58())}),e&&(u.sigVerify=!0),e&&"object"==typeof e&&"innerInstructions"in e&&(u.innerInstructions=e.innerInstructions);let l=[o,u],c=x(await this._rpcRequest("simulateTransaction",l),ep);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs)&&Array.isArray(t)){let e="\n ",r=e+t.join(e);console.error(c.error.message,r)}throw new tP({action:"simulate",signature:"",transactionMessage:c.error.message,logs:t})}return c.result}async sendTransaction(t,e,r){if("version"in t){if(e&&Array.isArray(e))throw Error("Invalid arguments");let r=t.serialize();return await this.sendRawTransaction(r,e)}if(void 0===e||!Array.isArray(e))throw Error("Invalid arguments");if(t.nonceInfo)t.sign(...e);else{let r=this._disableBlockhashCaching;for(;;){let i=await this._blockhashWithExpiryBlockHeight(r);if(t.lastValidBlockHeight=i.lastValidBlockHeight,t.recentBlockhash=i.blockhash,t.sign(...e),!t.signature)throw Error("!signature");let n=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(n))r=!0;else{this._blockhashInfo.transactionSignatures.push(n);break}}}let i=t.serialize();return await this.sendRawTransaction(i,r)}async sendRawTransaction(t,e){let r=ti(t).toString("base64");return await this.sendEncodedTransaction(r,e)}async sendEncodedTransaction(t,e){let r={encoding:"base64"},i=e&&e.skipPreflight,n=!0===i?"processed":e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(r.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(r.minContextSlot=e.minContextSlot),i&&(r.skipPreflight=i),n&&(r.preflightCommitment=n);let s=[t,r],o=x(await this._rpcRequest("sendTransaction",s),rb);if("error"in o){let t;throw"data"in o.error&&(t=o.error.data.logs),new tP({action:i?"send":"simulate",signature:"",transactionMessage:o.error.message,logs:t})}return o.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3===t)?this._updateSubscriptions():(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))}_setSubscription(t,e){let r=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,r!==e.state){let r=this._subscriptionStateChangeCallbacksByHash[t];r&&r.forEach(t=>{try{t(e.state)}catch{}})}}_onSubscriptionStateChange(t,e){let r=this._subscriptionHashByClientSubscriptionId[t];if(null==r)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[r]||=new Set;return i.add(e),()=>{i.delete(e),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}},500));return}if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();let t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async t=>{let r=this._subscriptionsByHash[t];if(void 0!==r)switch(r.state){case"pending":case"unsubscribed":if(0===r.callbacks.size){delete this._subscriptionsByHash[t],"unsubscribed"===r.state&&delete this._subscriptionCallbacksByServerSubscriptionId[r.serverSubscriptionId],await this._updateSubscriptions();return}await (async()=>{let{args:i,method:n}=r;try{this._setSubscription(t,{...r,state:"subscribing"});let e=await this._rpcWebSocket.call(n,i);this._setSubscription(t,{...r,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=r.callbacks,await this._updateSubscriptions()}catch(s){if(console.error(`Received ${s instanceof Error?"":"JSON-RPC "}error calling \`${n}\``,{args:i,error:s}),!e())return;this._setSubscription(t,{...r,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===r.callbacks.size&&await (async()=>{let{serverSubscriptionId:i,unsubscribeMethod:n}=r;if(this._subscriptionsAutoDisposedByRpc.has(i))this._subscriptionsAutoDisposedByRpc.delete(i);else{this._setSubscription(t,{...r,state:"unsubscribing"}),this._setSubscription(t,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(n,[i])}catch(i){if(i instanceof Error&&console.error(`${n} error:`,i.message),!e())return;this._setSubscription(t,{...r,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(t,{...r,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(t,e){let r=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==r&&r.forEach(t=>{try{t(...e)}catch(t){console.error(t)}})}_wsOnAccountNotification(t){let{result:e,subscription:r}=x(t,ez);this._handleServerNotification(r,[e.value,e.context])}_makeSubscription(t,e){let r=this._nextClientSubscriptionId++,i=tH([t.method,e]),n=this._subscriptionsByHash[i];return void 0===n?this._subscriptionsByHash[i]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:n.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let e=this._subscriptionsByHash[i];tm(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${r}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(t,e,r){let{commitment:i,config:n}=t6(r),s=this._buildArgs([t.toBase58()],i||this._commitment||"finalized","base64",n);return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},s)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){let{result:e,subscription:r}=x(t,ej);this._handleServerNotification(r,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,r,i){let{commitment:n,config:s}=t6(r),o=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",s||(i?{filters:t3(i)}:void 0));return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},o)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,r){let i=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],r||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){let{result:e,subscription:r}=x(t,rk);this._handleServerNotification(r,[e.value,e.context])}_wsOnSlotNotification(t){let{result:e,subscription:r}=x(t,eq);this._handleServerNotification(r,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){let{result:e,subscription:r}=x(t,e$);this._handleServerNotification(r,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){let r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,r,i){let n=e||this._commitment;if(n||r||i){let e={};r&&(e.encoding=r),n&&(e.commitment=n),i&&(e=Object.assign(e,i)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,r,i){let n=e||this._commitment;if(n&&!["confirmed","finalized"].includes(n))throw Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,r,i)}_wsOnSignatureNotification(t){let{result:e,subscription:r}=x(t,eF);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,r){let i=this._buildArgs([t],r||this._commitment||"finalized"),n=this._makeSubscription({callback:(t,r)=>{if("status"===t.type){e(t.result,r);try{this.removeSignatureListener(n)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return n}onSignatureWithOptions(t,e,r){let{commitment:i,...n}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},s=this._buildArgs([t],i,void 0,n),o=this._makeSubscription({callback:(t,r)=>{e(t,r);try{this.removeSignatureListener(o)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return o}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){let{result:e,subscription:r}=x(t,eH);this._handleServerNotification(r,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class rM{constructor(t){this._keypair=void 0,this._keypair=t??Q()}static generate(){return new rM(Q())}static fromSecretKey(t,e){if(64!==t.byteLength)throw Error("bad secret key size");let r=t.slice(32,64);if(!e||!e.skipValidation){let e=X(t.slice(0,32));for(let t=0;t<32;t++)if(r[t]!==e[t])throw Error("provided secretKey is invalid")}return new rM({publicKey:r,secretKey:t})}static fromSeed(t){let e=X(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),new rM({publicKey:e,secretKey:r})}get publicKey(){return new ta(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:g.struct([g.u32("instruction"),tq("recentSlot"),g.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:g.struct([g.u32("instruction")])},ExtendLookupTable:{index:2,layout:g.struct([g.u32("instruction"),tq(),g.seq(tf(),g.offset(g.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:g.struct([g.u32("instruction")])},CloseLookupTable:{index:4,layout:g.struct([g.u32("instruction")])}}),new ta("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:g.struct([g.u8("instruction"),g.u32("units"),g.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:g.struct([g.u8("instruction"),g.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:g.struct([g.u8("instruction"),g.u32("units")])},SetComputeUnitPrice:{index:3,layout:g.struct([g.u8("instruction"),tq("microLamports")])}}),new ta("ComputeBudget111111111111111111111111111111");let rA=g.struct([g.u8("numSignatures"),g.u8("padding"),g.u16("signatureOffset"),g.u16("signatureInstructionIndex"),g.u16("publicKeyOffset"),g.u16("publicKeyInstructionIndex"),g.u16("messageDataOffset"),g.u16("messageDataSize"),g.u16("messageInstructionIndex")]);class rI{constructor(){}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,instructionIndex:n}=t;tm(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),tm(64===i.length,`Signature must be 64 bytes but received ${i.length} bytes`);let s=rA.span,o=s+e.length,u=o+i.length,l=a.Buffer.alloc(u+r.length),c=null==n?65535:n;return rA.encode({numSignatures:1,padding:0,signatureOffset:o,signatureInstructionIndex:c,publicKeyOffset:s,publicKeyInstructionIndex:c,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:c},l),l.fill(e,s),l.fill(i,o),l.fill(r,u),new tI({keys:[],programId:rI.programId,data:l})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;tm(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{let t=rM.fromSecretKey(e),n=t.publicKey.toBytes(),s=te(r,t.secretKey);return this.createInstructionWithPublicKey({publicKey:n,message:r,signature:s,instructionIndex:i})}catch(t){throw Error(`Error creating instruction; ${t}`)}}}rI.programId=new ta("Ed25519SigVerify111111111111111111111111111"),G.bI.utils.isValidPrivateKey;let rx=G.bI.getPublicKey,r_=g.struct([g.u8("numSignatures"),g.u16("signatureOffset"),g.u8("signatureInstructionIndex"),g.u16("ethAddressOffset"),g.u8("ethAddressInstructionIndex"),g.u16("messageDataOffset"),g.u16("messageDataSize"),g.u8("messageInstructionIndex"),g.blob(20,"ethAddress"),g.blob(64,"signature"),g.u8("recoveryId")]);class rB{constructor(){}static publicKeyToEthAddress(t){tm(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return a.Buffer.from((0,Z.lY)(ti(t))).slice(-20)}catch(t){throw Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,recoveryId:n,instructionIndex:s}=t;return rB.createInstructionWithEthAddress({ethAddress:rB.publicKeyToEthAddress(e),message:r,signature:i,recoveryId:n,instructionIndex:s})}static createInstructionWithEthAddress(t){let e,{ethAddress:r,message:i,signature:n,recoveryId:s,instructionIndex:o=0}=t;tm(20===(e="string"==typeof r?r.startsWith("0x")?a.Buffer.from(r.substr(2),"hex"):a.Buffer.from(r,"hex"):r).length,`Address must be 20 bytes but received ${e.length} bytes`);let u=12+e.length,l=u+n.length+1,c=a.Buffer.alloc(r_.span+i.length);return r_.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:o,signature:ti(n),ethAddress:ti(e),recoveryId:s},c),c.fill(ti(i),r_.span),new tI({keys:[],programId:rB.programId,data:c})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;tm(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{var n;let t,s=ti(e),o=rx(s,!1).slice(1),[u,l]=(n=a.Buffer.from((0,Z.lY)(ti(r))),[(t=G.bI.sign(n,s)).toCompactRawBytes(),t.recovery]);return this.createInstructionWithPublicKey({publicKey:o,message:r,signature:u,recoveryId:l,instructionIndex:i})}catch(t){throw Error(`Error creating instruction; ${t}`)}}}rB.programId=new ta("KeccakSecp256k11111111111111111111111111111");let rT=new ta("StakeConfig11111111111111111111111111111111");class rC{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}}rC.default=new rC(0,0,ta.default);let rR=Object.freeze({Initialize:{index:0,layout:g.struct([g.u32("instruction"),((t="authorized")=>g.struct([tf("staker"),tf("withdrawer")],t))(),((t="lockup")=>g.struct([g.ns64("unixTimestamp"),g.ns64("epoch"),tf("custodian")],t))()])},Authorize:{index:1,layout:g.struct([g.u32("instruction"),tf("newAuthorized"),g.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:g.struct([g.u32("instruction")])},Split:{index:3,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},Withdraw:{index:4,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},Deactivate:{index:5,layout:g.struct([g.u32("instruction")])},Merge:{index:7,layout:g.struct([g.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:g.struct([g.u32("instruction"),tf("newAuthorized"),g.u32("stakeAuthorizationType"),td("authoritySeed"),tf("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class rP{constructor(){}static initialize(t){let{stakePubkey:e,authorized:r,lockup:i}=t,n=i||rC.default,s=tW(rR.Initialize,{authorized:{staker:ti(r.staker.toBuffer()),withdrawer:ti(r.withdrawer.toBuffer())},lockup:{unixTimestamp:n.unixTimestamp,epoch:n.epoch,custodian:ti(n.custodian.toBuffer())}});return new tI({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tC,isSigner:!1,isWritable:!1}],programId:this.programId,data:s})}static createAccountWithSeed(t){let e=new tx;e.add(t$.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static createAccount(t){let e=new tx;e.add(t$.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:r,votePubkey:i}=t,n=tW(rR.Delegate);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:tR,isSigner:!1,isWritable:!1},{pubkey:rT,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static authorize(t){let{stakePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,stakeAuthorizationType:n,custodianPubkey:s}=t,o=tW(rR.Authorize,{newAuthorized:ti(i.toBuffer()),stakeAuthorizationType:n.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new tx().add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:r,authoritySeed:i,authorityOwner:n,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=t,u=tW(rR.AuthorizeWithSeed,{newAuthorized:ti(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:i,authorityOwner:ti(n.toBuffer())}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:tB,isSigner:!1,isWritable:!1}];return a&&l.push({pubkey:a,isSigner:!0,isWritable:!1}),new tx().add({keys:l,programId:this.programId,data:u})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:r,splitStakePubkey:i,lamports:n}=t,s=tW(rR.Split,{lamports:n});return new tI({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(t,e){let r=new tx;return r.add(t$.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),r.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,basePubkey:s,seed:o,lamports:a}=t,u=new tx;return u.add(t$.allocate({accountPubkey:n,basePubkey:s,seed:o,space:this.space,programId:this.programId})),e&&e>0&&u.add(t$.transfer({fromPubkey:t.authorizedPubkey,toPubkey:n,lamports:e})),u.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,lamports:a}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:r,authorizedPubkey:i}=t,n=tW(rR.Merge);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:tR,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:r,toPubkey:i,lamports:n,custodianPubkey:s}=t,o=tW(rR.Withdraw,{lamports:n}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:tR,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new tx().add({keys:a,programId:this.programId,data:o})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:r}=t,i=tW(rR.Deactivate);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}}rP.programId=new ta("Stake11111111111111111111111111111111111111"),rP.space=200;let rL=Object.freeze({InitializeAccount:{index:0,layout:g.struct([g.u32("instruction"),((t="voteInit")=>g.struct([tf("nodePubkey"),tf("authorizedVoter"),tf("authorizedWithdrawer"),g.u8("commission")],t))()])},Authorize:{index:1,layout:g.struct([g.u32("instruction"),tf("newAuthorized"),g.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:g.struct([g.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:g.struct([g.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>g.struct([g.u32("voteAuthorizationType"),tf("currentAuthorityDerivedKeyOwnerPubkey"),td("currentAuthorityDerivedKeySeed"),tf("newAuthorized")],t))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class rU{constructor(){}static initializeAccount(t){let{votePubkey:e,nodePubkey:r,voteInit:i}=t,n=tW(rL.InitializeAccount,{voteInit:{nodePubkey:ti(i.nodePubkey.toBuffer()),authorizedVoter:ti(i.authorizedVoter.toBuffer()),authorizedWithdrawer:ti(i.authorizedWithdrawer.toBuffer()),commission:i.commission}});return new tI({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tC,isSigner:!1,isWritable:!1},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static createAccount(t){let e=new tx;return e.add(t$.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,voteAuthorizationType:n}=t,s=tW(rL.Authorize,{newAuthorized:ti(i.toBuffer()),voteAuthorizationType:n.index});return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:n,voteAuthorizationType:s,votePubkey:o}=t,a=tW(rL.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:ti(r.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:ti(n.toBuffer()),voteAuthorizationType:s.index}});return new tx().add({keys:[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,lamports:i,toPubkey:n}=t,s=tW(rL.Withdraw,{lamports:i});return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static safeWithdraw(t,e,r){if(t.lamports>e-r)throw Error("Withdraw will leave vote account with insufficient funds.");return rU.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,nodePubkey:i}=t,n=tW(rL.UpdateValidatorIdentity);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}}rU.programId=new ta("Vote111111111111111111111111111111111111111"),rU.space=3762,new ta("Va1idator1nfo111111111111111111111111111111"),j({name:z(),website:O(z()),details:O(z()),iconUrl:O(z()),keybaseUsername:O(z())}),new ta("Vote111111111111111111111111111111111111111"),g.struct([tf("nodePubkey"),tf("authorizedWithdrawer"),g.u8("commission"),g.nu64(),g.seq(g.struct([g.nu64("slot"),g.u32("confirmationCount")]),g.offset(g.u32(),-8),"votes"),g.u8("rootSlotValid"),g.nu64("rootSlot"),g.nu64(),g.seq(g.struct([g.nu64("epoch"),tf("authorizedVoter")]),g.offset(g.u32(),-8),"authorizedVoters"),g.struct([g.seq(g.struct([tf("authorizedPubkey"),g.nu64("epochOfLastAuthorizedSwitch"),g.nu64("targetEpoch")]),32,"buf"),g.nu64("idx"),g.u8("isEmpty")],"priorVoters"),g.nu64(),g.seq(g.struct([g.nu64("epoch"),g.nu64("credits"),g.nu64("prevCredits")]),g.offset(g.u32(),-8),"epochCredits"),g.struct([g.nu64("slot"),g.nu64("timestamp")],"lastTimestamp")])},9948:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(("le"===e||"be"===e)&&(r=e,e=10),this._init(t||0,e||10,r||"be"))}"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{h="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3112).Buffer}catch(t){}function o(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function u(t,e,r,n){for(var s=0,o=0,a=Math.min(t.length,r),u=e;u<a;u++){var l=t.charCodeAt(u)-48;s*=n,o=l>=49?l-49+10:l>=17?l-17+10:l,i(l>=0&&o<n,"Invalid character"),s+=o}return s}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return 0>t.cmp(e)?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<0x4000000?(this.words=[0x3ffffff&t],this.length=1):t<0x10000000000000?(this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff],this.length=2):(i(t<0x20000000000000),this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=t.length-1,n=0;o>=0;o-=3)s=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(o=0,n=0;o<t.length;o+=3)s=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);return this._strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var i,n=0;n<this.length;n++)this.words[n]=0;var s=0,o=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=0x3ffffff;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,l=0,c=r;c<a;c+=i)l=u(t,c,c+i,e),this.imuln(n),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==o){var h=1;for(l=u(t,c,t.length,e),c=0;c<o;c++)h*=e;this.imuln(h),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this._strip()},s.prototype.copy=function(t){t.words=Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype._move=function(t){l(t,this)},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){s.prototype.inspect=c}else s.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h,f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];function g(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=0x3ffffff&o,u=o/0x4000000|0;r.words[0]=a;for(var l=1;l<i;l++){for(var c=u>>>26,h=0x3ffffff&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;c+=(o=(n=0|t.words[p])*(s=0|e.words[d])+h)/0x4000000|0,h=0x3ffffff&o}r.words[l]=0|h,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}s.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){for(var r="",n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=((a<<n|s)&0xffffff).toString(16);s=a>>>24-n&0xffffff,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],c=p[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var g=h.modrn(c).toString(t);r=(h=h.idivn(c)).isZero()?g+r:f[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=0x4000000*this.words[1]:3===this.length&&1===this.words[2]?t+=0x10000000000000+0x4000000*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},h&&(s.prototype.toBuffer=function(t,e){return this.toArrayLike(h,t,e)}),s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=t.allocUnsafe?t.allocUnsafe(s):new t(s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===s?(r<t.length&&(t[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},s.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return(8191&e)==0&&(r+=13,e>>>=13),(127&e)==0&&(r+=7,e>>>=7),(15&e)==0&&(r+=4,e>>>=4),(3&e)==0&&(r+=2,e>>>=2),(1&e)==0&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},s.prototype.ior=function(t){return i((this.negative|t.negative)==0),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},s.prototype.iand=function(t){return i((this.negative|t.negative)==0),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},s.prototype.ixor=function(t){return i((this.negative|t.negative)==0),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=0x3ffffff&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&0x3ffffff>>26-r),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),e?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),this._strip()},s.prototype.iadd=function(t){if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e,r,i,n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=0x3ffffff&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=0x3ffffff&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(e=this,r=t):(e=t,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|e.words[o])-(0|r.words[o])+s)>>26,this.words[o]=0x3ffffff&i;for(;0!==s&&o<e.length;o++)s=(i=(0|e.words[o])+s)>>26,this.words[o]=0x3ffffff&i;if(0===s&&o<e.length&&e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this.length=Math.max(this.length,o),e!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var i,n,s,o=t.words,a=e.words,u=r.words,l=0,c=0|o[0],h=8191&c,f=c>>>13,d=0|o[1],p=8191&d,g=d>>>13,m=0|o[2],y=8191&m,w=m>>>13,b=0|o[3],v=8191&b,k=b>>>13,S=0|o[4],E=8191&S,M=S>>>13,A=0|o[5],I=8191&A,x=A>>>13,_=0|o[6],B=8191&_,T=_>>>13,C=0|o[7],R=8191&C,P=C>>>13,L=0|o[8],U=8191&L,O=L>>>13,W=0|o[9],z=8191&W,N=W>>>13,j=0|a[0],K=8191&j,q=j>>>13,D=0|a[1],$=8191&D,F=D>>>13,H=0|a[2],V=8191&H,J=H>>>13,Y=0|a[3],Z=8191&Y,G=Y>>>13,Q=0|a[4],X=8191&Q,tt=Q>>>13,te=0|a[5],tr=8191&te,ti=te>>>13,tn=0|a[6],ts=8191&tn,to=tn>>>13,ta=0|a[7],tu=8191&ta,tl=ta>>>13,tc=0|a[8],th=8191&tc,tf=tc>>>13,td=0|a[9],tp=8191&td,tg=td>>>13;r.negative=t.negative^e.negative,r.length=19,i=Math.imul(h,K);var tm=(l+i|0)+((8191&(n=(n=Math.imul(h,q))+Math.imul(f,K)|0))<<13)|0;l=((s=Math.imul(f,q))+(n>>>13)|0)+(tm>>>26)|0,tm&=0x3ffffff,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(g,K)|0,s=Math.imul(g,q),i=i+Math.imul(h,$)|0;var ty=(l+i|0)+((8191&(n=(n=n+Math.imul(h,F)|0)+Math.imul(f,$)|0))<<13)|0;l=((s=s+Math.imul(f,F)|0)+(n>>>13)|0)+(ty>>>26)|0,ty&=0x3ffffff,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(w,K)|0,s=Math.imul(w,q),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(g,$)|0,s=s+Math.imul(g,F)|0,i=i+Math.imul(h,V)|0;var tw=(l+i|0)+((8191&(n=(n=n+Math.imul(h,J)|0)+Math.imul(f,V)|0))<<13)|0;l=((s=s+Math.imul(f,J)|0)+(n>>>13)|0)+(tw>>>26)|0,tw&=0x3ffffff,i=Math.imul(v,K),n=(n=Math.imul(v,q))+Math.imul(k,K)|0,s=Math.imul(k,q),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,F)|0)+Math.imul(w,$)|0,s=s+Math.imul(w,F)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,J)|0,i=i+Math.imul(h,Z)|0;var tb=(l+i|0)+((8191&(n=(n=n+Math.imul(h,G)|0)+Math.imul(f,Z)|0))<<13)|0;l=((s=s+Math.imul(f,G)|0)+(n>>>13)|0)+(tb>>>26)|0,tb&=0x3ffffff,i=Math.imul(E,K),n=(n=Math.imul(E,q))+Math.imul(M,K)|0,s=Math.imul(M,q),i=i+Math.imul(v,$)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,F)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,V)|0,s=s+Math.imul(w,J)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,G)|0,i=i+Math.imul(h,X)|0;var tv=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tt)|0)+Math.imul(f,X)|0))<<13)|0;l=((s=s+Math.imul(f,tt)|0)+(n>>>13)|0)+(tv>>>26)|0,tv&=0x3ffffff,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(x,K)|0,s=Math.imul(x,q),i=i+Math.imul(E,$)|0,n=(n=n+Math.imul(E,F)|0)+Math.imul(M,$)|0,s=s+Math.imul(M,F)|0,i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,J)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(w,Z)|0,s=s+Math.imul(w,G)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,X)|0,s=s+Math.imul(g,tt)|0,i=i+Math.imul(h,tr)|0;var tk=(l+i|0)+((8191&(n=(n=n+Math.imul(h,ti)|0)+Math.imul(f,tr)|0))<<13)|0;l=((s=s+Math.imul(f,ti)|0)+(n>>>13)|0)+(tk>>>26)|0,tk&=0x3ffffff,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(T,K)|0,s=Math.imul(T,q),i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,F)|0)+Math.imul(x,$)|0,s=s+Math.imul(x,F)|0,i=i+Math.imul(E,V)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(M,V)|0,s=s+Math.imul(M,J)|0,i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,G)|0)+Math.imul(k,Z)|0,s=s+Math.imul(k,G)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,s=s+Math.imul(w,tt)|0,i=i+Math.imul(p,tr)|0,n=(n=n+Math.imul(p,ti)|0)+Math.imul(g,tr)|0,s=s+Math.imul(g,ti)|0,i=i+Math.imul(h,ts)|0;var tS=(l+i|0)+((8191&(n=(n=n+Math.imul(h,to)|0)+Math.imul(f,ts)|0))<<13)|0;l=((s=s+Math.imul(f,to)|0)+(n>>>13)|0)+(tS>>>26)|0,tS&=0x3ffffff,i=Math.imul(R,K),n=(n=Math.imul(R,q))+Math.imul(P,K)|0,s=Math.imul(P,q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,F)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,F)|0,i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(x,V)|0,s=s+Math.imul(x,J)|0,i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,G)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,G)|0,i=i+Math.imul(v,X)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(k,X)|0,s=s+Math.imul(k,tt)|0,i=i+Math.imul(y,tr)|0,n=(n=n+Math.imul(y,ti)|0)+Math.imul(w,tr)|0,s=s+Math.imul(w,ti)|0,i=i+Math.imul(p,ts)|0,n=(n=n+Math.imul(p,to)|0)+Math.imul(g,ts)|0,s=s+Math.imul(g,to)|0,i=i+Math.imul(h,tu)|0;var tE=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tl)|0)+Math.imul(f,tu)|0))<<13)|0;l=((s=s+Math.imul(f,tl)|0)+(n>>>13)|0)+(tE>>>26)|0,tE&=0x3ffffff,i=Math.imul(U,K),n=(n=Math.imul(U,q))+Math.imul(O,K)|0,s=Math.imul(O,q),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,F)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,F)|0,i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,J)|0,i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,G)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,G)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(M,X)|0,s=s+Math.imul(M,tt)|0,i=i+Math.imul(v,tr)|0,n=(n=n+Math.imul(v,ti)|0)+Math.imul(k,tr)|0,s=s+Math.imul(k,ti)|0,i=i+Math.imul(y,ts)|0,n=(n=n+Math.imul(y,to)|0)+Math.imul(w,ts)|0,s=s+Math.imul(w,to)|0,i=i+Math.imul(p,tu)|0,n=(n=n+Math.imul(p,tl)|0)+Math.imul(g,tu)|0,s=s+Math.imul(g,tl)|0,i=i+Math.imul(h,th)|0;var tM=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tf)|0)+Math.imul(f,th)|0))<<13)|0;l=((s=s+Math.imul(f,tf)|0)+(n>>>13)|0)+(tM>>>26)|0,tM&=0x3ffffff,i=Math.imul(z,K),n=(n=Math.imul(z,q))+Math.imul(N,K)|0,s=Math.imul(N,q),i=i+Math.imul(U,$)|0,n=(n=n+Math.imul(U,F)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,F)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,G)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,G)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(x,X)|0,s=s+Math.imul(x,tt)|0,i=i+Math.imul(E,tr)|0,n=(n=n+Math.imul(E,ti)|0)+Math.imul(M,tr)|0,s=s+Math.imul(M,ti)|0,i=i+Math.imul(v,ts)|0,n=(n=n+Math.imul(v,to)|0)+Math.imul(k,ts)|0,s=s+Math.imul(k,to)|0,i=i+Math.imul(y,tu)|0,n=(n=n+Math.imul(y,tl)|0)+Math.imul(w,tu)|0,s=s+Math.imul(w,tl)|0,i=i+Math.imul(p,th)|0,n=(n=n+Math.imul(p,tf)|0)+Math.imul(g,th)|0,s=s+Math.imul(g,tf)|0,i=i+Math.imul(h,tp)|0;var tA=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tg)|0)+Math.imul(f,tp)|0))<<13)|0;l=((s=s+Math.imul(f,tg)|0)+(n>>>13)|0)+(tA>>>26)|0,tA&=0x3ffffff,i=Math.imul(z,$),n=(n=Math.imul(z,F))+Math.imul(N,$)|0,s=Math.imul(N,F),i=i+Math.imul(U,V)|0,n=(n=n+Math.imul(U,J)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,G)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,X)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(I,tr)|0,n=(n=n+Math.imul(I,ti)|0)+Math.imul(x,tr)|0,s=s+Math.imul(x,ti)|0,i=i+Math.imul(E,ts)|0,n=(n=n+Math.imul(E,to)|0)+Math.imul(M,ts)|0,s=s+Math.imul(M,to)|0,i=i+Math.imul(v,tu)|0,n=(n=n+Math.imul(v,tl)|0)+Math.imul(k,tu)|0,s=s+Math.imul(k,tl)|0,i=i+Math.imul(y,th)|0,n=(n=n+Math.imul(y,tf)|0)+Math.imul(w,th)|0,s=s+Math.imul(w,tf)|0,i=i+Math.imul(p,tp)|0;var tI=(l+i|0)+((8191&(n=(n=n+Math.imul(p,tg)|0)+Math.imul(g,tp)|0))<<13)|0;l=((s=s+Math.imul(g,tg)|0)+(n>>>13)|0)+(tI>>>26)|0,tI&=0x3ffffff,i=Math.imul(z,V),n=(n=Math.imul(z,J))+Math.imul(N,V)|0,s=Math.imul(N,J),i=i+Math.imul(U,Z)|0,n=(n=n+Math.imul(U,G)|0)+Math.imul(O,Z)|0,s=s+Math.imul(O,G)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(B,tr)|0,n=(n=n+Math.imul(B,ti)|0)+Math.imul(T,tr)|0,s=s+Math.imul(T,ti)|0,i=i+Math.imul(I,ts)|0,n=(n=n+Math.imul(I,to)|0)+Math.imul(x,ts)|0,s=s+Math.imul(x,to)|0,i=i+Math.imul(E,tu)|0,n=(n=n+Math.imul(E,tl)|0)+Math.imul(M,tu)|0,s=s+Math.imul(M,tl)|0,i=i+Math.imul(v,th)|0,n=(n=n+Math.imul(v,tf)|0)+Math.imul(k,th)|0,s=s+Math.imul(k,tf)|0,i=i+Math.imul(y,tp)|0;var tx=(l+i|0)+((8191&(n=(n=n+Math.imul(y,tg)|0)+Math.imul(w,tp)|0))<<13)|0;l=((s=s+Math.imul(w,tg)|0)+(n>>>13)|0)+(tx>>>26)|0,tx&=0x3ffffff,i=Math.imul(z,Z),n=(n=Math.imul(z,G))+Math.imul(N,Z)|0,s=Math.imul(N,G),i=i+Math.imul(U,X)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(O,X)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(R,tr)|0,n=(n=n+Math.imul(R,ti)|0)+Math.imul(P,tr)|0,s=s+Math.imul(P,ti)|0,i=i+Math.imul(B,ts)|0,n=(n=n+Math.imul(B,to)|0)+Math.imul(T,ts)|0,s=s+Math.imul(T,to)|0,i=i+Math.imul(I,tu)|0,n=(n=n+Math.imul(I,tl)|0)+Math.imul(x,tu)|0,s=s+Math.imul(x,tl)|0,i=i+Math.imul(E,th)|0,n=(n=n+Math.imul(E,tf)|0)+Math.imul(M,th)|0,s=s+Math.imul(M,tf)|0,i=i+Math.imul(v,tp)|0;var t_=(l+i|0)+((8191&(n=(n=n+Math.imul(v,tg)|0)+Math.imul(k,tp)|0))<<13)|0;l=((s=s+Math.imul(k,tg)|0)+(n>>>13)|0)+(t_>>>26)|0,t_&=0x3ffffff,i=Math.imul(z,X),n=(n=Math.imul(z,tt))+Math.imul(N,X)|0,s=Math.imul(N,tt),i=i+Math.imul(U,tr)|0,n=(n=n+Math.imul(U,ti)|0)+Math.imul(O,tr)|0,s=s+Math.imul(O,ti)|0,i=i+Math.imul(R,ts)|0,n=(n=n+Math.imul(R,to)|0)+Math.imul(P,ts)|0,s=s+Math.imul(P,to)|0,i=i+Math.imul(B,tu)|0,n=(n=n+Math.imul(B,tl)|0)+Math.imul(T,tu)|0,s=s+Math.imul(T,tl)|0,i=i+Math.imul(I,th)|0,n=(n=n+Math.imul(I,tf)|0)+Math.imul(x,th)|0,s=s+Math.imul(x,tf)|0,i=i+Math.imul(E,tp)|0;var tB=(l+i|0)+((8191&(n=(n=n+Math.imul(E,tg)|0)+Math.imul(M,tp)|0))<<13)|0;l=((s=s+Math.imul(M,tg)|0)+(n>>>13)|0)+(tB>>>26)|0,tB&=0x3ffffff,i=Math.imul(z,tr),n=(n=Math.imul(z,ti))+Math.imul(N,tr)|0,s=Math.imul(N,ti),i=i+Math.imul(U,ts)|0,n=(n=n+Math.imul(U,to)|0)+Math.imul(O,ts)|0,s=s+Math.imul(O,to)|0,i=i+Math.imul(R,tu)|0,n=(n=n+Math.imul(R,tl)|0)+Math.imul(P,tu)|0,s=s+Math.imul(P,tl)|0,i=i+Math.imul(B,th)|0,n=(n=n+Math.imul(B,tf)|0)+Math.imul(T,th)|0,s=s+Math.imul(T,tf)|0,i=i+Math.imul(I,tp)|0;var tT=(l+i|0)+((8191&(n=(n=n+Math.imul(I,tg)|0)+Math.imul(x,tp)|0))<<13)|0;l=((s=s+Math.imul(x,tg)|0)+(n>>>13)|0)+(tT>>>26)|0,tT&=0x3ffffff,i=Math.imul(z,ts),n=(n=Math.imul(z,to))+Math.imul(N,ts)|0,s=Math.imul(N,to),i=i+Math.imul(U,tu)|0,n=(n=n+Math.imul(U,tl)|0)+Math.imul(O,tu)|0,s=s+Math.imul(O,tl)|0,i=i+Math.imul(R,th)|0,n=(n=n+Math.imul(R,tf)|0)+Math.imul(P,th)|0,s=s+Math.imul(P,tf)|0,i=i+Math.imul(B,tp)|0;var tC=(l+i|0)+((8191&(n=(n=n+Math.imul(B,tg)|0)+Math.imul(T,tp)|0))<<13)|0;l=((s=s+Math.imul(T,tg)|0)+(n>>>13)|0)+(tC>>>26)|0,tC&=0x3ffffff,i=Math.imul(z,tu),n=(n=Math.imul(z,tl))+Math.imul(N,tu)|0,s=Math.imul(N,tl),i=i+Math.imul(U,th)|0,n=(n=n+Math.imul(U,tf)|0)+Math.imul(O,th)|0,s=s+Math.imul(O,tf)|0,i=i+Math.imul(R,tp)|0;var tR=(l+i|0)+((8191&(n=(n=n+Math.imul(R,tg)|0)+Math.imul(P,tp)|0))<<13)|0;l=((s=s+Math.imul(P,tg)|0)+(n>>>13)|0)+(tR>>>26)|0,tR&=0x3ffffff,i=Math.imul(z,th),n=(n=Math.imul(z,tf))+Math.imul(N,th)|0,s=Math.imul(N,tf),i=i+Math.imul(U,tp)|0;var tP=(l+i|0)+((8191&(n=(n=n+Math.imul(U,tg)|0)+Math.imul(O,tp)|0))<<13)|0;l=((s=s+Math.imul(O,tg)|0)+(n>>>13)|0)+(tP>>>26)|0,tP&=0x3ffffff,i=Math.imul(z,tp);var tL=(l+i|0)+((8191&(n=(n=Math.imul(z,tg))+Math.imul(N,tp)|0))<<13)|0;return l=((s=Math.imul(N,tg))+(n>>>13)|0)+(tL>>>26)|0,tL&=0x3ffffff,u[0]=tm,u[1]=ty,u[2]=tw,u[3]=tb,u[4]=tv,u[5]=tk,u[6]=tS,u[7]=tE,u[8]=tM,u[9]=tA,u[10]=tI,u[11]=tx,u[12]=t_,u[13]=tB,u[14]=tT,u[15]=tC,u[16]=tR,u[17]=tP,u[18]=tL,0!==l&&(u[19]=l,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=0x3ffffff&i,u=Math.min(s,e.length-1),l=Math.max(0,s-t.length+1);l<=u;l++){var c=s-l,h=(0|t.words[c])*(0|e.words[l]),f=0x3ffffff&h;o=o+(h/0x4000000|0)|0,a=0x3ffffff&(f=f+a|0),n+=(o=o+(f>>>26)|0)>>>26,o&=0x3ffffff}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function w(t,e){this.x=t,this.y=e}Math.imul||(m=g),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return 10===this.length&&10===t.length?r=m(this,t,e):i<63?r=g(this,t,e):r=y(this,t,e),r},w.prototype.makeRBT=function(t){for(var e=Array(t),r=s.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},w.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},w.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},w.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),c=0;c<n;c+=a)for(var h=u,f=l,d=0;d<o;d++){var p=r[c+d],g=i[c+d],m=r[c+d+o],y=i[c+d+o],w=h*m-f*y;y=h*y+f*m,m=w,r[c+d]=p+m,i[c+d]=g+y,r[c+d+o]=p-m,i[c+d+o]=g-y,d!==a&&(w=u*h-l*f,f=u*f+l*h,h=w)}},w.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},w.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},w.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=0x3ffffff&n,r=n<0x4000000?0:n/0x4000000|0}return t},w.prototype.convert13b=function(t,e,r,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)r[o]=0;i(0===s),i((-8192&s)==0)},w.prototype.stub=function(t){for(var e=Array(t),r=0;r<t;r++)e[r]=0;return e},w.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),u=Array(i),l=Array(i),c=Array(i),h=Array(i),f=r.words;f.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,l,i),this.transform(o,s,a,u,i,n),this.transform(l,s,c,h,i,n);for(var d=0;d<i;d++){var p=a[d]*c[d]-u[d]*h[d];u[d]=a[d]*h[d]+u[d]*c[d],a[d]=p}return this.conjugate(a,u,i),this.transform(a,u,f,s,i,n),this.conjugate(f,s,i),this.normalize13b(f,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=Array(this.length+t.length),y(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){var e=t<0;e&&(t=-t),i("number"==typeof t),i(t<0x4000000);for(var r=0,n=0;n<this.length;n++){var s=(0|this.words[n])*t,o=(0x3ffffff&s)+(0x3ffffff&r);r>>=26,r+=(s/0x4000000|0)+(o>>>26),this.words[n]=0x3ffffff&o}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,s=0x3ffffff>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,u=(0|this.words[e])-a<<r;this.words[e]=u|o,o=a>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){i("number"==typeof t&&t>=0);var n=e?(e-e%26)/26:0,s=t%26,o=Math.min((t-s)/26,this.length),a=0x3ffffff^0x3ffffff>>>s<<s;if(n-=o,n=Math.max(0,n),r){for(var u=0;u<o;u++)r.words[u]=this.words[u];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-s|c>>>s,l=c&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return!(this.length<=r)&&!!(this.words[r]&1<<e)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==e&&r++,this.length=Math.min(r,this.length),0!==e&&(this.words[this.length-1]&=0x3ffffff^0x3ffffff>>>e<<e),this._strip())},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return(i("number"==typeof t),i(t<0x4000000),t<0)?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=0x4000000;e++)this.words[e]-=0x4000000,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<0x4000000),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=0x4000000,this.words[e+1]-=1;return this._strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,s,o=t.length+r;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+r])+a;var u=(0|t.words[n])*e;s-=0x3ffffff&u,a=(s>>26)-(u/0x4000000|0),this.words[n+r]=0x3ffffff&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=0x3ffffff&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=0x3ffffff&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,e){var r,i=this.length-t.length,n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),n.iushln(i),a=0|o.words[o.length-1]);var u=n.length-o.length;if("mod"!==e){(r=new s(null)).length=u+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,r&&(r.words[u]=1));for(var h=u-1;h>=0;h--){var f=(0|n.words[o.length+h])*0x4000000+(0|n.words[o.length+h-1]);for(f=Math.min(f/a|0,0x3ffffff),n._ishlnsubmul(o,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,h),n.isZero()||(n.negative^=1);r&&(r.words[h]=f)}return r&&r._strip(),n._strip(),"div"!==e&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(t,e,r){var n,o,a;return(i(!t.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):(this.negative&t.negative)!=0?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||0>this.cmp(t)?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=0x3ffffff);for(var r=0x4000000%t,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%t;return e?-n:n},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=0x3ffffff);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+0x4000000*r;this.words[n]=s/t|0,r=s%t}return this._strip(),e?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;(e.words[0]&d)==0&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(c),o.isub(h)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;(r.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(u)):(r.isub(e),a.isub(n),u.isub(o))}return{a:a,b:u,gcd:r.iushln(l)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e,r=this,n=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var o=new s(1),a=new s(0),u=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,c=1;(r.words[0]&c)==0&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var h=0,f=1;(n.words[0]&f)==0&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(a)):(n.isub(r),a.isub(o))}return 0>(e=0===r.cmpn(1)?o:a).cmpn(0)&&e.iadd(t),e},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=0x3ffffff,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=0x3ffffff,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return -1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return -1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return -1===this.cmpn(t)},s.prototype.lt=function(t){return -1===this.cmp(t)},s.prototype.lten=function(t){return 0>=this.cmpn(t)},s.prototype.lte=function(t){return 0>=this.cmp(t)},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new A(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function I(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new s(null);return t.words=Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(k,v),k.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9){t.words[0]=0,t.length=1;return}var n=t.words[9];for(i=10,e.words[e.length++]=4194303&n;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},k.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=0x3ffffff&e,e=64*i+(e/0x4000000|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(S,v),n(E,v),n(M,v),M.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=(0|t.words[r])*19+e,n=0x3ffffff&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){var e;if(b[t])return b[t];if("k256"===t)e=new k;else if("p224"===t)e=new S;else if("p192"===t)e=new E;else if("p25519"===t)e=new M;else throw Error("Unknown prime "+t);return b[t]=e,e},A.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){i((t.negative|e.negative)==0,"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,n),f=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();i(m<p);var y=this.pow(h,new s(1).iushln(p-m-1));f=f.redMul(y),h=y.redSqr(),d=d.redMul(h),p=m}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),i=e.length-1;i>=0;i--){for(var l=e.words[i],c=u-1;c>=0;c--){var h=l>>c&1;if(n!==r[0]&&(n=this.sqr(n)),0===h&&0===o){a=0;continue}o<<=1,o|=h,(4==++a||0===i&&0===c)&&(n=this.mul(n,r[o]),a=0,o=0)}u=26}return n},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new I(t)},n(I,A),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},8866:function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__decorate||function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeUnchecked=e.deserialize=e.serialize=e.BinaryReader=e.BinaryWriter=e.BorshError=e.baseDecode=e.baseEncode=void 0;let u=a(r(9948)),l=a(r(6846)),c=o(r(2614)),h=new("function"!=typeof TextDecoder?c.TextDecoder:TextDecoder)("utf-8",{fatal:!0});e.baseEncode=function(t){return"string"==typeof t&&(t=Buffer.from(t,"utf8")),l.default.encode(Buffer.from(t))},e.baseDecode=function(t){return Buffer.from(l.default.decode(t))};class f extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}e.BorshError=f;class d{constructor(){this.buf=Buffer.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(1024)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(1024)]),this.length+=t.length}writeString(t){this.maybeResize();let e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){for(let r of(this.maybeResize(),this.writeU32(t.length),t))this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}}function p(t,e,r){let i=r.value;r.value=function(...t){try{return i.apply(this,t)}catch(t){if(t instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t.code)>=0)throw new f("Reached the end of buffer when deserializing");throw t}}}e.BinaryWriter=d;class g{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new u.default(t,"le")}readU128(){let t=this.readBuffer(16);return new u.default(t,"le")}readU256(){let t=this.readBuffer(32);return new u.default(t,"le")}readU512(){let t=this.readBuffer(64);return new u.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new f(`Expected buffer length ${t} isn't within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return h.decode(e)}catch(t){throw new f(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),r=[];for(let i=0;i<e;++i)r.push(t());return r}}function m(t){return t.charAt(0).toUpperCase()+t.slice(1)}function y(t,e,r,i,n){try{if("string"==typeof i)n[`write${m(i)}`](r);else if(i instanceof Array)if("number"==typeof i[0]){if(r.length!==i[0])throw new f(`Expecting byte array of length ${i[0]}, but got ${r.length} bytes`);n.writeFixedArray(r)}else if(2===i.length&&"number"==typeof i[1]){if(r.length!==i[1])throw new f(`Expecting byte array of length ${i[1]}, but got ${r.length} bytes`);for(let e=0;e<i[1];e++)y(t,null,r[e],i[0],n)}else n.writeArray(r,r=>{y(t,e,r,i[0],n)});else if(void 0!==i.kind)switch(i.kind){case"option":null==r?n.writeU8(0):(n.writeU8(1),y(t,e,r,i.type,n));break;case"map":n.writeU32(r.size),r.forEach((r,s)=>{y(t,e,s,i.key,n),y(t,e,r,i.value,n)});break;default:throw new f(`FieldType ${i} unrecognized`)}else w(t,r,n)}catch(t){throw t instanceof f&&t.addToFieldPath(e),t}}function w(t,e,r){if("function"==typeof e.borshSerialize)return void e.borshSerialize(r);let i=t.get(e.constructor);if(!i)throw new f(`Class ${e.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{y(t,i,e[i],n,r)});else if("enum"===i.kind){let n=e[i.field];for(let s=0;s<i.values.length;++s){let[o,a]=i.values[s];if(o===n){r.writeU8(s),y(t,o,e[o],a,r);break}}}else throw new f(`Unexpected schema kind: ${i.kind} for ${e.constructor.name}`)}function b(t,e,r,i){try{if("string"==typeof r)return i[`read${m(r)}`]();if(r instanceof Array)if("number"==typeof r[0])return i.readFixedArray(r[0]);else{if("number"!=typeof r[1])return i.readArray(()=>b(t,e,r[0],i));let n=[];for(let e=0;e<r[1];e++)n.push(b(t,null,r[0],i));return n}if("option"===r.kind){if(i.readU8())return b(t,e,r.type,i);return}if("map"===r.kind){let n=new Map,s=i.readU32();for(let o=0;o<s;o++){let s=b(t,e,r.key,i),o=b(t,e,r.value,i);n.set(s,o)}return n}return v(t,r,i)}catch(t){throw t instanceof f&&t.addToFieldPath(e),t}}function v(t,e,r){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(r);let i=t.get(e);if(!i)throw new f(`Class ${e.name} is missing in schema`);if("struct"===i.kind){let i={};for(let[n,s]of t.get(e).fields)i[n]=b(t,n,s,r);return new e(i)}if("enum"===i.kind){let n=r.readU8();if(n>=i.values.length)throw new f(`Enum index: ${n} is out of range`);let[s,o]=i.values[n],a=b(t,s,o,r);return new e({[s]:a})}throw new f(`Unexpected schema kind: ${i.kind} for ${e.constructor.name}`)}s([p],g.prototype,"readU8",null),s([p],g.prototype,"readU16",null),s([p],g.prototype,"readU32",null),s([p],g.prototype,"readU64",null),s([p],g.prototype,"readU128",null),s([p],g.prototype,"readU256",null),s([p],g.prototype,"readU512",null),s([p],g.prototype,"readString",null),s([p],g.prototype,"readFixedArray",null),s([p],g.prototype,"readArray",null),e.BinaryReader=g,e.serialize=function(t,e,r=d){let i=new r;return w(t,e,i),i.toArray()},e.deserialize=function(t,e,r,i=g){let n=new i(r),s=v(t,e,n);if(n.offset<r.length)throw new f(`Unexpected ${r.length-n.offset} bytes after deserialized data`);return s},e.deserializeUnchecked=function(t,e,r,i=g){return v(t,e,new i(r))}},6846:function(t,e,r){t.exports=r(7107)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9774:function(t,e,r){t.exports=r(3863)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},6336:function(t,e,r){"use strict";var i=r(5186),n=r(7423),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t){var i=t,n=e;if(("string"!=typeof n||""===n)&&(n="utf8"),!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);var s=0|p(i,n),u=o(s),l=u.write(i,n);return l!==s&&(u=u.slice(0,l)),u}if(ArrayBuffer.isView(t)){var c=t;if(B(c,Uint8Array)){var g=new Uint8Array(c);return f(g.buffer,g.byteOffset,g.byteLength)}return h(c)}if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(B(t,SharedArrayBuffer)||t&&B(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');var m=t.valueOf&&t.valueOf();if(null!=m&&m!==t)return a.from(m,e,r);var y=function(t){if(a.isBuffer(t)){var e=0|d(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||function(t){return t!=t}(t.length)?o(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(y)return y;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),o(t<0?0:0|d(t))}function h(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function f(t,e,r){var i;if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),i}function d(t){if(t>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return I(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(n)return i?-1:I(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n,s,o,a=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=e;s<r;++s)n+=T[t[s]];return n}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}(this,e,r);case"latin1":case"binary":return function(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}(this,e,r);case"base64":return n=this,s=e,o=r,0===s&&o===n.length?i.fromByteArray(n):i.fromByteArray(n.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){for(var i=t.slice(e,r),n="",s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}(this,e,r);default:if(a)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),a=!0}}function m(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){var s;if(0===t.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(n)return -1;else r=t.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,i)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,i,n);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return w(t,[e],r,i,n)}throw TypeError("val must be string, number or Buffer")}function w(t,e,r,i,n){var s,o=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var c=-1;for(s=r;s<a;s++)if(l(t,s)===l(e,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===u)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){for(var h=!0,f=0;f<u;f++)if(l(t,s+f)!==l(e,f)){h=!1;break}if(h)return s}return -1}function b(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var s,o,a,u,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h<=r)switch(h){case 1:l<128&&(c=l);break;case 2:(192&(s=t[n+1]))==128&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],o=t[n+2],(192&s)==128&&(192&o)==128&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=h}var f=i,d=f.length;if(d<=4096)return String.fromCharCode.apply(String,f);for(var p="",g=0;g<d;)p+=String.fromCharCode.apply(String,f.slice(g,g+=4096));return p}function v(t,e,r){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}function k(t,e,r,i,n,s){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw RangeError('"value" argument is out of bounds');if(r+i>t.length)throw RangeError("Index out of range")}function S(t,e,r,i,n,s){if(r+i>t.length||r<0)throw RangeError("Index out of range")}function E(t,e,r,i,s){return e*=1,r>>>=0,s||S(t,e,r,4,34028234663852886e22,-34028234663852886e22),n.write(t,e,r,i,23,4),r+4}function M(t,e,r,i,s){return e*=1,r>>>=0,s||S(t,e,r,8,17976931348623157e292,-17976931348623157e292),n.write(t,e,r,i,52,8),r+8}e.Buffer=a,e.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return(l(t),t<=0)?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(B(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),B(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:+(i<r)},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);if(void 0===e)for(r=0,e=0;r<t.length;++r)e+=t[r].length;var r,i=a.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var s=t[r];if(B(s,Uint8Array))n+s.length>i.length?a.from(s).copy(i,n):Uint8Array.prototype.set.call(i,s,n);else if(a.isBuffer(s))s.copy(i,n);else throw TypeError('"list" argument must be an Array of Buffers');n+=s.length}return i},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0==arguments.length?b(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(t,e,r,i,n){if(B(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,n>>>=0,this===t)return 0;for(var s=n-i,o=r-e,u=Math.min(s,o),l=this.slice(i,n),c=t.slice(e,r),h=0;h<u;++h)if(l[h]!==c[h]){s=l[h],o=c[h];break}return s<o?-1:+(o<s)},a.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,s,o,a,u,l,c,h,f=this.length-e;if((void 0===r||r>f)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var d=!1;;)switch(i){case"hex":return function(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a,u=parseInt(e.substr(2*o,2),16);if((a=u)!=a)break;t[r+o]=u}return o}(this,t,e,r);case"utf8":case"utf-8":return n=e,s=r,_(I(t,this.length-n),this,n,s);case"ascii":case"latin1":case"binary":return o=e,a=r,_(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(t),this,o,a);case"base64":return u=e,l=r,_(x(t),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=e,h=r,_(function(t,e){for(var r,i,n=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n.push(r%256),n.push(i);return n}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||v(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return(t>>>=0,e||v(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||v(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||v(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;k(this,t,e,r,n,0)}var s=1,o=0;for(this[e]=255&t;++o<r&&(s*=256);)this[e+o]=t/s&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;k(this,t,e,r,n,0)}var s=r-1,o=1;for(this[e+s]=255&t;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,i){if(t*=1,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s<r&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+r},a.prototype.writeIntBE=function(t,e,r,i){if(t*=1,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return E(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return E(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,i){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},a.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===t.length){var n,s=t.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(t=s)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{var o=a.isBuffer(t)?t:a.from(t,i),u=o.length;if(0===u)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=o[n%u]}return this};var A=/[^+/0-9A-Za-z-_]/g;function I(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319||o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function x(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(A,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function _(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length)&&!(n>=t.length);++n)e[n+r]=t[n];return n}function B(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}var T=function(){for(var t="0123456789abcdef",e=Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)e[i+n]=t[r]+t[n];return e}()},6826:function(t,e,r){"use strict";let i=r(5186),n=r(7423),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t){var i=t,n=e;if(("string"!=typeof n||""===n)&&(n="utf8"),!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);let r=0|p(i,n),s=o(r),u=s.write(i,n);return u!==r&&(s=s.slice(0,u)),s}if(ArrayBuffer.isView(t)){var s=t;if(W(s,Uint8Array)){let t=new Uint8Array(s);return f(t.buffer,t.byteOffset,t.byteLength)}return h(s)}if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');let u=t.valueOf&&t.valueOf();if(null!=u&&u!==t)return a.from(u,e,r);let l=function(t){if(a.isBuffer(t)){let e=0|d(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||function(t){return t!=t}(t.length)?o(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(l)return l;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),o(t<0?0:0|d(t))}function h(t){let e=t.length<0?0:0|d(t.length),r=o(e);for(let i=0;i<e;i+=1)r[i]=255&t[i];return r}function f(t,e,r){let i;if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),i}function d(t){if(t>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(n)return i?-1:L(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=e;i<r;++i)n+=z[t[i]];return n}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}(this,e,r);case"latin1":case"binary":return function(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}(this,e,r);case"base64":var s,o,a;return s=this,o=e,a=r,0===o&&a===s.length?i.fromByteArray(s):i.fromByteArray(s.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){let i=t.slice(e,r),n="";for(let t=0;t<i.length-1;t+=2)n+=String.fromCharCode(i[t]+256*i[t+1]);return n}(this,e,r);default:if(n)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){var s;if(0===t.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(n)return -1;else r=t.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,i)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,i,n);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return w(t,[e],r,i,n)}throw TypeError("val must be string, number or Buffer")}function w(t,e,r,i,n){let s,o=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let i=-1;for(s=r;s<a;s++)if(l(t,s)===l(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===u)return i*o}else -1!==i&&(s-=s-i),i=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){let r=!0;for(let i=0;i<u;i++)if(l(t,s+i)!==l(e,i)){r=!1;break}if(r)return s}return -1}function b(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let e=t[n],s=null,o=e>239?4:e>223?3:e>191?2:1;if(n+o<=r){let r,i,a,u;switch(o){case 1:e<128&&(s=e);break;case 2:(192&(r=t[n+1]))==128&&(u=(31&e)<<6|63&r)>127&&(s=u);break;case 3:r=t[n+1],i=t[n+2],(192&r)==128&&(192&i)==128&&(u=(15&e)<<12|(63&r)<<6|63&i)>2047&&(u<55296||u>57343)&&(s=u);break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],(192&r)==128&&(192&i)==128&&(192&a)==128&&(u=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a)>65535&&u<1114112&&(s=u)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}var s=i;let o=s.length;if(o<=4096)return String.fromCharCode.apply(String,s);let a="",u=0;for(;u<o;)a+=String.fromCharCode.apply(String,s.slice(u,u+=4096));return a}function v(t,e,r){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}function k(t,e,r,i,n,s){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw RangeError('"value" argument is out of bounds');if(r+i>t.length)throw RangeError("Index out of range")}function S(t,e,r,i,n){T(e,i,n,t,r,7);let s=Number(e&BigInt(0xffffffff));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function E(t,e,r,i,n){T(e,i,n,t,r,7);let s=Number(e&BigInt(0xffffffff));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function M(t,e,r,i,n,s){if(r+i>t.length||r<0)throw RangeError("Index out of range")}function A(t,e,r,i,s){return e*=1,r>>>=0,s||M(t,e,r,4,34028234663852886e22,-34028234663852886e22),n.write(t,e,r,i,23,4),r+4}function I(t,e,r,i,s){return e*=1,r>>>=0,s||M(t,e,r,8,17976931348623157e292,-17976931348623157e292),n.write(t,e,r,i,52,8),r+8}e.Buffer=a,e.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return(l(t),t<=0)?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(W(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:+(i<r)},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){let r;if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);if(void 0===e)for(r=0,e=0;r<t.length;++r)e+=t[r].length;let i=a.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))n+e.length>i.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else if(a.isBuffer(e))e.copy(i,n);else throw TypeError('"list" argument must be an Array of Buffers');n+=e.length}return i},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){let t=this.length;return 0===t?"":0==arguments.length?b(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(t,e,r,i,n){if(W(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,n>>>=0,this===t)return 0;let s=n-i,o=r-e,u=Math.min(s,o),l=this.slice(i,n),c=t.slice(e,r);for(let t=0;t<u;++t)if(l[t]!==c[t]){s=l[t],o=c[t];break}return s<o?-1:+(o<s)},a.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,i){var n,s,o,a,u,l,c,h;if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-e;if((void 0===r||r>f)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let d=!1;for(;;)switch(i){case"hex":return function(t,e,r,i){let n;r=Number(r)||0;let s=t.length-r;i?(i=Number(i))>s&&(i=s):i=s;let o=e.length;for(i>o/2&&(i=o/2),n=0;n<i;++n){var a;let i=parseInt(e.substr(2*n,2),16);if((a=i)!=a)break;t[r+n]=i}return n}(this,t,e,r);case"utf8":case"utf-8":return n=e,s=r,O(L(t,this.length-n),this,n,s);case"ascii":case"latin1":case"binary":return o=e,a=r,O(function(t){let e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(t),this,o,a);case"base64":return u=e,l=r,O(U(t),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=e,h=r,O(function(t,e){let r,i,n=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n.push(r%256),n.push(i);return n}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(t,e){let r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||v(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&R(t,this.length-8);let i=e+256*this[++t]+65536*this[++t]+0x1000000*this[++t],n=this[++t]+256*this[++t]+65536*this[++t]+0x1000000*r;return BigInt(i)+(BigInt(n)<<BigInt(32))}),a.prototype.readBigUInt64BE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&R(t,this.length-8);let i=0x1000000*e+65536*this[++t]+256*this[++t]+this[++t],n=0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)}),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return(t>>>=0,e||v(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||v(t,2,this.length);let r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||v(t,2,this.length);let r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&R(t,this.length-8),(BigInt(this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24))<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+0x1000000*this[++t])}),a.prototype.readBigInt64BE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&R(t,this.length-8),(BigInt((e<<24)+65536*this[++t]+256*this[++t]+this[++t])<<BigInt(32))+BigInt(0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r)}),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}let n=1,s=0;for(this[e]=255&t;++s<r&&(n*=256);)this[e+s]=t/n&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=N(function(t,e=0){return S(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=N(function(t,e=0){return E(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(t,e,r,i){if(t*=1,e>>>=0,!i){let i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}let n=0,s=1,o=0;for(this[e]=255&t;++n<r&&(s*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},a.prototype.writeIntBE=function(t,e,r,i){if(t*=1,e>>>=0,!i){let i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=N(function(t,e=0){return S(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=N(function(t,e=0){return E(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(t,e,r){return A(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return A(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,i){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);let n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},a.prototype.fill=function(t,e,r,i){let n;if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===t.length){let e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{let s=a.isBuffer(t)?t:a.from(t,i),o=s.length;if(0===o)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=s[n%o]}return this};let x={};function _(t,e,r){x[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function B(t){let e="",r=t.length,i=+("-"===t[0]);for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function T(t,e,r,i,n,s){if(t>r||t<e){let i,n="bigint"==typeof e?"n":"";throw i=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${(s+1)*8}${n}`:`>= -(2${n} ** ${(s+1)*8-1}${n}) and < 2 ** ${(s+1)*8-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new x.ERR_OUT_OF_RANGE("value",i,t)}C(n,"offset"),(void 0===i[n]||void 0===i[n+s])&&R(n,i.length-(s+1))}function C(t,e){if("number"!=typeof t)throw new x.ERR_INVALID_ARG_TYPE(e,"number",t)}function R(t,e,r){if(Math.floor(t)!==t)throw C(t,r),new x.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new x.ERR_BUFFER_OUT_OF_BOUNDS;throw new x.ERR_OUT_OF_RANGE(r||"offset",`>= ${+!!r} and <= ${e}`,t)}_("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),_("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),_("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?n=B(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=B(n)),n+="n"),i+=` It must be ${e}. Received ${n}`},RangeError);let P=/[^+/0-9A-Za-z-_]/g;function L(t,e){let r;e=e||1/0;let i=t.length,n=null,s=[];for(let o=0;o<i;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319||o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function U(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function O(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length)&&!(n>=t.length);++n)e[n+r]=t[n];return n}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}let z=function(){let t="0123456789abcdef",e=Array(256);for(let r=0;r<16;++r){let i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function N(t){return"undefined"==typeof BigInt?j:t}function j(){throw Error("BigInt not supported")}},2466:function(t,e,r){"use strict";let i=r(1876).v4,n=r(5325),s=function(t,e){if(!(this instanceof s))return new s(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return i()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};t.exports=s,s.prototype.request=function(t,e,r,i){let s,o=this,a=null,u=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&u)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!u&&t&&"object"==typeof t&&"function"==typeof e;if(u||l)i=e,a=t;else{"function"==typeof r&&(i=r,r=void 0);let s="function"==typeof i;try{a=n(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(s)return i(t);throw t}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(t){return i(t)}return this.callServer(s,function(t,e){o._parseResponse(t,e,i)}),a},s.prototype._parseResponse=function(t,e,r){let i;if(t)return void r(t);if(!e)return r();try{i=JSON.parse(e,this.options.reviver)}catch(t){return r(t)}if(3===r.length)if(!Array.isArray(i))return r(null,i.error,i.result);else{let t=function(t){return void 0!==t.error};return r(null,i.filter(t),i.filter(function(e){return!t(e)}))}r(null,i)}},5325:function(t,e,r){"use strict";let i=r(1876).v4;t.exports=function(t,e,r,n){if("string"!=typeof t)throw TypeError(t+" must be a string");let s="number"==typeof(n=n||{}).version?n.version:2;if(1!==s&&2!==s)throw TypeError(s+" must be 1 or 2");let o={method:t};if(2===s&&(o.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw TypeError(e+" must be an object, array or omitted");o.params=e}return void 0===r?o.id=("function"==typeof n.generator?n.generator:function(){return i()})(o,n):2===s&&null===r?n.notificationIdNull&&(o.id=null):o.id=r,o}},8817:function(t,e,r){let i=r(6675),n=r(9643),s=r(1745),o=r(2550);function a(t,e,r,s,o){let a=[].slice.call(arguments,1),u=a.length,l="function"==typeof a[u-1];if(!l&&!i())throw Error("Callback required as last argument");if(l){if(u<2)throw Error("Too few arguments provided");2===u?(o=r,r=e,e=s=void 0):3===u&&(e.getContext&&void 0===o?(o=s,s=void 0):(o=s,s=r,r=e,e=void 0))}else{if(u<1)throw Error("Too few arguments provided");return 1===u?(r=e,e=s=void 0):2!==u||e.getContext||(s=r,r=e,e=void 0),new Promise(function(i,o){try{let o=n.create(r,s);i(t(o,e,s))}catch(t){o(t)}})}try{let i=n.create(r,s);o(null,t(i,e,s))}catch(t){o(t)}}e.create=n.create,e.toCanvas=a.bind(null,s.render),e.toDataURL=a.bind(null,s.renderToDataURL),e.toString=a.bind(null,function(t,e,r){return o.render(t,r)})},6675:function(t){t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},3559:function(t,e,r){let i=r(1984).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];let e=Math.floor(t/7)+2,r=i(t),n=145===r?26:2*Math.ceil((r-13)/(2*e-2)),s=[r-7];for(let t=1;t<e-1;t++)s[t]=s[t-1]-n;return s.push(6),s.reverse()},e.getPositions=function(t){let r=[],i=e.getRowColCoords(t),n=i.length;for(let t=0;t<n;t++)for(let e=0;e<n;e++)(0!==t||0!==e)&&(0!==t||e!==n-1)&&(t!==n-1||0!==e)&&r.push([i[t],i[e]]);return r}},1523:function(t,e,r){let i=r(3670),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(t){this.mode=i.ALPHANUMERIC,this.data=t}s.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=45*n.indexOf(this.data[e]);r+=n.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(n.indexOf(this.data[e]),6)},t.exports=s},9745:function(t){function e(){this.buffer=[],this.length=0}e.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=e},742:function(t){function e(t){if(!t||t<1)throw Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}e.prototype.set=function(t,e,r,i){let n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)},e.prototype.get=function(t,e){return this.data[t*this.size+e]},e.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},e.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},t.exports=e},6920:function(t,e,r){let i=r(3670);function n(t){this.mode=i.BYTE,"string"==typeof t?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)},t.exports=n},4936:function(t,e,r){let i=r(4059),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(t,e){switch(e){case i.L:return n[(t-1)*4+0];case i.M:return n[(t-1)*4+1];case i.Q:return n[(t-1)*4+2];case i.H:return n[(t-1)*4+3];default:return}},e.getTotalCodewordsCount=function(t,e){switch(e){case i.L:return s[(t-1)*4+0];case i.M:return s[(t-1)*4+1];case i.Q:return s[(t-1)*4+2];case i.H:return s[(t-1)*4+3];default:return}}},4059:function(t,e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{if("string"!=typeof t)throw Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw Error("Unknown EC Level: "+t)}}catch(t){return r}}},370:function(t,e,r){let i=r(1984).getSymbolSize;e.getPositions=function(t){let e=i(t);return[[0,0],[e-7,0],[0,e-7]]}},1547:function(t,e,r){let i=r(1984),n=i.getBCHDigit(1335);e.getEncodedBits=function(t,e){let r=t.bit<<3|e,s=r<<10;for(;i.getBCHDigit(s)-n>=0;)s^=1335<<i.getBCHDigit(s)-n;return(r<<10|s)^21522}},6069:function(t,e){let r=new Uint8Array(512),i=new Uint8Array(256),n=1;for(let t=0;t<255;t++)r[t]=n,i[n]=t,256&(n<<=1)&&(n^=285);for(let t=255;t<512;t++)r[t]=r[t-255];e.log=function(t){if(t<1)throw Error("log("+t+")");return i[t]},e.exp=function(t){return r[t]},e.mul=function(t,e){return 0===t||0===e?0:r[i[t]+i[e]]}},6499:function(t,e,r){let i=r(3670),n=r(1984);function s(t){this.mode=i.KANJI,this.data=t}s.getBitsLength=function(t){return 13*t},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=n.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");r=(r>>>8&255)*192+(255&r),t.put(r,13)}},t.exports=s},3238:function(t,e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};e.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){let e=t.size,r=0,i=0,n=0,s=null,o=null;for(let a=0;a<e;a++){i=n=0,s=o=null;for(let u=0;u<e;u++){let e=t.get(a,u);e===s?i++:(i>=5&&(r+=3+(i-5)),s=e,i=1),(e=t.get(u,a))===o?n++:(n>=5&&(r+=3+(n-5)),o=e,n=1)}i>=5&&(r+=3+(i-5)),n>=5&&(r+=3+(n-5))}return r},e.getPenaltyN2=function(t){let e=t.size,r=0;for(let i=0;i<e-1;i++)for(let n=0;n<e-1;n++){let e=t.get(i,n)+t.get(i,n+1)+t.get(i+1,n)+t.get(i+1,n+1);(4===e||0===e)&&r++}return 3*r},e.getPenaltyN3=function(t){let e=t.size,r=0,i=0,n=0;for(let s=0;s<e;s++){i=n=0;for(let o=0;o<e;o++)i=i<<1&2047|t.get(s,o),o>=10&&(1488===i||93===i)&&r++,n=n<<1&2047|t.get(o,s),o>=10&&(1488===n||93===n)&&r++}return 40*r},e.getPenaltyN4=function(t){let e=0,r=t.data.length;for(let i=0;i<r;i++)e+=t.data[i];return 10*Math.abs(Math.ceil(100*e/r/5)-10)},e.applyMask=function(t,r){let i=r.size;for(let n=0;n<i;n++)for(let s=0;s<i;s++)r.isReserved(s,n)||r.xor(s,n,function(t,r,i){switch(t){case e.Patterns.PATTERN000:return(r+i)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return i%3==0;case e.Patterns.PATTERN011:return(r+i)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(i/3))%2==0;case e.Patterns.PATTERN101:return r*i%2+r*i%3==0;case e.Patterns.PATTERN110:return(r*i%2+r*i%3)%2==0;case e.Patterns.PATTERN111:return(r*i%3+(r+i)%2)%2==0;default:throw Error("bad maskPattern:"+t)}}(t,s,n))},e.getBestMask=function(t,r){let i=Object.keys(e.Patterns).length,n=0,s=1/0;for(let o=0;o<i;o++){r(o),e.applyMask(o,t);let i=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),i<s&&(s=i,n=o)}return n}},3670:function(t,e,r){let i=r(9700),n=r(34);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw Error("Invalid mode: "+t);if(!i.isValid(e))throw Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{if("string"!=typeof t)throw Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw Error("Unknown mode: "+t)}}catch(t){return r}}},1515:function(t,e,r){let i=r(3670);function n(t){this.mode=i.NUMERIC,this.data=t.toString()}n.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){let e,r;for(e=0;e+3<=this.data.length;e+=3)r=parseInt(this.data.substr(e,3),10),t.put(r,10);let i=this.data.length-e;i>0&&(r=parseInt(this.data.substr(e),10),t.put(r,3*i+1))},t.exports=n},9687:function(t,e,r){let i=r(6069);e.mul=function(t,e){let r=new Uint8Array(t.length+e.length-1);for(let n=0;n<t.length;n++)for(let s=0;s<e.length;s++)r[n+s]^=i.mul(t[n],e[s]);return r},e.mod=function(t,e){let r=new Uint8Array(t);for(;r.length-e.length>=0;){let t=r[0];for(let n=0;n<e.length;n++)r[n]^=i.mul(e[n],t);let n=0;for(;n<r.length&&0===r[n];)n++;r=r.slice(n)}return r},e.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=e.mul(r,new Uint8Array([1,i.exp(n)]));return r}},9643:function(t,e,r){let i=r(1984),n=r(4059),s=r(9745),o=r(742),a=r(3559),u=r(370),l=r(3238),c=r(4936),h=r(3014),f=r(8861),d=r(1547),p=r(3670),g=r(4259);function m(t,e,r){let i,n,s=t.size,o=d.getEncodedBits(e,r);for(i=0;i<15;i++)n=(o>>i&1)==1,i<6?t.set(i,8,n,!0):i<8?t.set(i+1,8,n,!0):t.set(s-15+i,8,n,!0),i<8?t.set(8,s-i-1,n,!0):i<9?t.set(8,15-i-1+1,n,!0):t.set(8,15-i-1,n,!0);t.set(s-8,8,1,!0)}e.create=function(t,e){let r,d;if(void 0===t||""===t)throw Error("No input text");let y=n.M;return void 0!==e&&(y=n.from(e.errorCorrectionLevel,n.M),r=f.from(e.version),d=l.from(e.maskPattern),e.toSJISFunc&&i.setToSJISFunction(e.toSJISFunc)),function(t,e,r,n){let d;if(Array.isArray(t))d=g.fromArray(t);else if("string"==typeof t){let i=e;if(!i){let e=g.rawSplit(t);i=f.getBestVersionForData(e,r)}d=g.fromString(t,i||40)}else throw Error("Invalid data");let y=f.getBestVersionForData(d,r);if(!y)throw Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<y)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else e=y;let w=function(t,e,r){let n=new s;r.forEach(function(e){n.put(e.mode.bit,4),n.put(e.getLength(),p.getCharCountIndicator(e.mode,t)),e.write(n)});let o=(i.getSymbolTotalCodewords(t)-c.getTotalCodewordsCount(t,e))*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let t=0;t<a;t++)n.put(t%2?17:236,8);return function(t,e,r){let n,s,o=i.getSymbolTotalCodewords(e),a=o-c.getTotalCodewordsCount(e,r),u=c.getBlocksCount(e,r),l=o%u,f=u-l,d=Math.floor(o/u),p=Math.floor(a/u),g=p+1,m=d-p,y=new h(m),w=0,b=Array(u),v=Array(u),k=0,S=new Uint8Array(t.buffer);for(let t=0;t<u;t++){let e=t<f?p:g;b[t]=S.slice(w,w+e),v[t]=y.encode(b[t]),w+=e,k=Math.max(k,e)}let E=new Uint8Array(o),M=0;for(n=0;n<k;n++)for(s=0;s<u;s++)n<b[s].length&&(E[M++]=b[s][n]);for(n=0;n<m;n++)for(s=0;s<u;s++)E[M++]=v[s][n];return E}(n,t,e)}(e,r,d),b=new o(i.getSymbolSize(e));!function(t,e){let r=t.size,i=u.getPositions(e);for(let e=0;e<i.length;e++){let n=i[e][0],s=i[e][1];for(let e=-1;e<=7;e++)if(!(n+e<=-1)&&!(r<=n+e))for(let i=-1;i<=7;i++)s+i<=-1||r<=s+i||(e>=0&&e<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===e||6===e)||e>=2&&e<=4&&i>=2&&i<=4?t.set(n+e,s+i,!0,!0):t.set(n+e,s+i,!1,!0))}}(b,e);let v=b.size;for(let t=8;t<v-8;t++){let e=t%2==0;b.set(t,6,e,!0),b.set(6,t,e,!0)}return!function(t,e){let r=a.getPositions(e);for(let e=0;e<r.length;e++){let i=r[e][0],n=r[e][1];for(let e=-2;e<=2;e++)for(let r=-2;r<=2;r++)-2===e||2===e||-2===r||2===r||0===e&&0===r?t.set(i+e,n+r,!0,!0):t.set(i+e,n+r,!1,!0)}}(b,e),m(b,r,0),e>=7&&function(t,e){let r,i,n,s=t.size,o=f.getEncodedBits(e);for(let e=0;e<18;e++)r=Math.floor(e/3),i=e%3+s-8-3,n=(o>>e&1)==1,t.set(r,i,n,!0),t.set(i,r,n,!0)}(b,e),!function(t,e){let r=t.size,i=-1,n=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!t.isReserved(n,a-r)){let i=!1;o<e.length&&(i=(e[o]>>>s&1)==1),t.set(n,a-r,i),-1==--s&&(o++,s=7)}if((n+=i)<0||r<=n){n-=i,i=-i;break}}}(b,w),isNaN(n)&&(n=l.getBestMask(b,m.bind(null,b,r))),l.applyMask(n,b),m(b,r,n),{modules:b,version:e,errorCorrectionLevel:r,maskPattern:n,segments:d}}(t,r,y,d)}},3014:function(t,e,r){let i=r(9687);function n(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(t){this.degree=t,this.genPoly=i.generateECPolynomial(this.degree)},n.prototype.encode=function(t){if(!this.genPoly)throw Error("Encoder not initialized");let e=new Uint8Array(t.length+this.degree);e.set(t);let r=i.mod(e,this.genPoly),n=this.degree-r.length;if(n>0){let t=new Uint8Array(this.degree);return t.set(r,n),t}return r},t.exports=n},34:function(t,e){let r="[0-9]+",i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(i=i.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";e.KANJI=RegExp(i,"g"),e.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),e.BYTE=RegExp(n,"g"),e.NUMERIC=RegExp(r,"g"),e.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let s=RegExp("^"+i+"$"),o=RegExp("^"+r+"$"),a=RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(t){return s.test(t)},e.testNumeric=function(t){return o.test(t)},e.testAlphanumeric=function(t){return a.test(t)}},4259:function(t,e,r){let i=r(3670),n=r(1515),s=r(1523),o=r(6920),a=r(6499),u=r(34),l=r(1984),c=r(4993);function h(t){return unescape(encodeURIComponent(t)).length}function f(t,e,r){let i,n=[];for(;null!==(i=t.exec(r));)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function d(t){let e,r,n=f(u.NUMERIC,i.NUMERIC,t),s=f(u.ALPHANUMERIC,i.ALPHANUMERIC,t);return l.isKanjiModeEnabled()?(e=f(u.BYTE,i.BYTE,t),r=f(u.KANJI,i.KANJI,t)):(e=f(u.BYTE_KANJI,i.BYTE,t),r=[]),n.concat(s,e,r).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function p(t,e){switch(e){case i.NUMERIC:return n.getBitsLength(t);case i.ALPHANUMERIC:return s.getBitsLength(t);case i.KANJI:return a.getBitsLength(t);case i.BYTE:return o.getBitsLength(t)}}function g(t,e){let r,u=i.getBestModeForData(t);if((r=i.from(e,u))!==i.BYTE&&r.bit<u.bit)throw Error('"'+t+'" cannot be encoded with mode '+i.toString(r)+".\n Suggested mode is: "+i.toString(u));switch(r===i.KANJI&&!l.isKanjiModeEnabled()&&(r=i.BYTE),r){case i.NUMERIC:return new n(t);case i.ALPHANUMERIC:return new s(t);case i.KANJI:return new a(t);case i.BYTE:return new o(t)}}e.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(g(e,null)):e.data&&t.push(g(e.data,e.mode)),t},[])},e.fromString=function(t,r){let n=function(t,e){let r={},n={start:{}},s=["start"];for(let o=0;o<t.length;o++){let a=t[o],u=[];for(let t=0;t<a.length;t++){let l=a[t],c=""+o+t;u.push(c),r[c]={node:l,lastCount:0},n[c]={};for(let t=0;t<s.length;t++){let o=s[t];r[o]&&r[o].node.mode===l.mode?(n[o][c]=p(r[o].lastCount+l.length,l.mode)-p(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),n[o][c]=p(l.length,l.mode)+4+i.getCharCountIndicator(l.mode,e))}}s=u}for(let t=0;t<s.length;t++)n[s[t]].end=0;return{map:n,table:r}}(function(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];switch(n.mode){case i.NUMERIC:e.push([n,{data:n.data,mode:i.ALPHANUMERIC,length:n.length},{data:n.data,mode:i.BYTE,length:n.length}]);break;case i.ALPHANUMERIC:e.push([n,{data:n.data,mode:i.BYTE,length:n.length}]);break;case i.KANJI:e.push([n,{data:n.data,mode:i.BYTE,length:h(n.data)}]);break;case i.BYTE:e.push([{data:n.data,mode:i.BYTE,length:h(n.data)}])}}return e}(d(t,l.isKanjiModeEnabled())),r),s=c.find_path(n.map,"start","end"),o=[];for(let t=1;t<s.length-1;t++)o.push(n.table[s[t]].node);return e.fromArray(o.reduce(function(t,e){let r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?t[t.length-1].data+=e.data:t.push(e),t},[]))},e.rawSplit=function(t){return e.fromArray(d(t,l.isKanjiModeEnabled()))}},1984:function(t,e){let r,i=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw Error('"version" cannot be null or undefined');if(t<1||t>40)throw Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return i[t]},e.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw Error('"toSJISFunc" is not a valid function.');r=t},e.isKanjiModeEnabled=function(){return void 0!==r},e.toSJIS=function(t){return r(t)}},9700:function(t,e){e.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}},8861:function(t,e,r){let i=r(1984),n=r(4936),s=r(4059),o=r(3670),a=r(9700),u=i.getBCHDigit(7973);function l(t,e){return o.getCharCountIndicator(t,e)+4}e.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},e.getCapacity=function(t,e,r){if(!a.isValid(t))throw Error("Invalid QR Code version");void 0===r&&(r=o.BYTE);let s=(i.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,e))*8;if(r===o.MIXED)return s;let u=s-l(r,t);switch(r){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){let i,n=s.from(r,s.M);if(Array.isArray(t)){if(t.length>1){for(let r=1;r<=40;r++)if(function(t,e){let r=0;return t.forEach(function(t){let i=l(t.mode,e);r+=i+t.getBitsLength()}),r}(t,r)<=e.getCapacity(r,n,o.MIXED))return r;return}if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,i){for(let n=1;n<=40;n++)if(r<=e.getCapacity(n,i,t))return n}(i.mode,i.getLength(),n)},e.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw Error("Invalid QR Code version");let e=t<<12;for(;i.getBCHDigit(e)-u>=0;)e^=7973<<i.getBCHDigit(e)-u;return t<<12|e}},1745:function(t,e,r){let i=r(6892);e.render=function(t,e,r){var n;let s=r,o=e;void 0!==s||e&&e.getContext||(s=e,e=void 0),e||(o=function(){try{return document.createElement("canvas")}catch(t){throw Error("You need to specify a canvas element")}}()),s=i.getOptions(s);let a=i.getImageWidth(t.modules.size,s),u=o.getContext("2d"),l=u.createImageData(a,a);return i.qrToImageData(l.data,t,s),n=o,u.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=a,n.width=a,n.style.height=a+"px",n.style.width=a+"px",u.putImageData(l,0,0),o},e.renderToDataURL=function(t,r,i){let n=i;void 0!==n||r&&r.getContext||(n=r,r=void 0),n||(n={});let s=e.render(t,r,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}},2550:function(t,e,r){let i=r(6892);function n(t,e){let r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function s(t,e,r){let i=t+e;return void 0!==r&&(i+=" "+r),i}e.render=function(t,e,r){let o=i.getOptions(e),a=t.modules.size,u=t.modules.data,l=a+2*o.margin,c=o.color.light.a?"<path "+n(o.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+n(o.color.dark,"stroke")+' d="'+function(t,e,r){let i="",n=0,o=!1,a=0;for(let u=0;u<t.length;u++){let l=Math.floor(u%e),c=Math.floor(u/e);l||o||(o=!0),t[u]?(a++,u>0&&l>0&&t[u-1]||(i+=o?s("M",l+r,.5+c+r):s("m",n,0),n=0,o=!1),l+1<e&&t[u+1]||(i+=s("h",a),a=0)):n++}return i}(u,a,o.margin)+'"/>',f='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+('viewBox="0 0 '+l+" ")+l+'" shape-rendering="crispEdges">'+c+h+"</svg>\n";return"function"==typeof r&&r(null,f),f}},6892:function(t,e){function r(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw Error("Invalid hex color: "+t);(3===e.length||4===e.length)&&(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+e.slice(0,6).join("")}}e.getOptions=function(t){t||(t={}),t.color||(t.color={});let e=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,i=t.width&&t.width>=21?t.width:void 0,n=t.scale||4;return{width:i,scale:i?4:n,margin:e,color:{dark:r(t.color.dark||"#000000ff"),light:r(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},e.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},e.getImageWidth=function(t,r){let i=e.getScale(t,r);return Math.floor((t+2*r.margin)*i)},e.qrToImageData=function(t,r,i){let n=r.modules.size,s=r.modules.data,o=e.getScale(n,i),a=Math.floor((n+2*i.margin)*o),u=i.margin*o,l=[i.color.light,i.color.dark];for(let e=0;e<a;e++)for(let r=0;r<a;r++){let c=(e*a+r)*4,h=i.color.light;e>=u&&r>=u&&e<a-u&&r<a-u&&(h=l[+!!s[Math.floor((e-u)/o)*n+Math.floor((r-u)/o)]]),t[c++]=h.r,t[c++]=h.g,t[c++]=h.b,t[c]=h.a}}},3112:function(){},6198:function(t,e,r){"use strict";r.d(e,{Ce:()=>a,Ok:()=>n});var i,n,s=r(9977),o=r(7858);(i=n||(n={})).Installed="Installed",i.NotDetected="NotDetected",i.Loadable="Loadable",i.Unsupported="Unsupported";class a extends s.A{get connected(){return!!this.publicKey}async autoConnect(){await this.connect()}async prepareTransaction(t,e,r={}){let i=this.publicKey;if(!i)throw new o.kW;return t.feePayer=t.feePayer||i,t.recentBlockhash=t.recentBlockhash||(await e.getLatestBlockhash({commitment:r.preflightCommitment,minContextSlot:r.minContextSlot})).blockhash,t}}},7858:function(t,e,r){"use strict";r.d(e,{AE:()=>n,Ez:()=>s,K3:()=>p,Kd:()=>c,PQ:()=>a,UF:()=>f,Y6:()=>o,Y8:()=>u,fk:()=>l,kW:()=>h,m7:()=>i,o7:()=>g,z4:()=>d});class i extends Error{constructor(t,e){super(t),this.error=e}}class n extends i{constructor(){super(...arguments),this.name="WalletNotReadyError"}}class s extends i{constructor(){super(...arguments),this.name="WalletConfigError"}}class o extends i{constructor(){super(...arguments),this.name="WalletConnectionError"}}class a extends i{constructor(){super(...arguments),this.name="WalletDisconnectedError"}}class u extends i{constructor(){super(...arguments),this.name="WalletDisconnectionError"}}class l extends i{constructor(){super(...arguments),this.name="WalletAccountError"}}class c extends i{constructor(){super(...arguments),this.name="WalletPublicKeyError"}}class h extends i{constructor(){super(...arguments),this.name="WalletNotConnectedError"}}class f extends i{constructor(){super(...arguments),this.name="WalletSendTransactionError"}}class d extends i{constructor(){super(...arguments),this.name="WalletSignTransactionError"}}class p extends i{constructor(){super(...arguments),this.name="WalletSignMessageError"}}class g extends i{constructor(){super(...arguments),this.name="WalletSignInError"}}},4971:function(t,e,r){"use strict";r.d(e,{S:()=>o});var i=r(4763),n=r(5074),s=r(871);let o=({children:t,endpoint:e,config:r={commitment:"confirmed"}})=>{let o=(0,n.useMemo)(()=>new i.Ng(e,r),[e,r]);return n.createElement(s.E.Provider,{value:{connection:o}},t)}},8521:function(t,e,r){"use strict";let i,n,s,o;r.d(e,{r:()=>eV});var a,u,l,c,h,f,d,p,g,m,y,w,b,v,k,S,E,M,A,I,x,_,B,T,C,R,P,L,U,O,W,z,N,j,K,q,D,$,F,H,V,J,Y,Z,G,Q,X,tt,te,tr,ti,tn,ts,to,ta,tu,tl,tc,th,tf,td,tp,tg,tm,ty,tw,tb,tv,tk,tS,tE,tM,tA,tI,tx,t_,tB=r(6198),tT=r(7858);function tC(t){return"version"in t}class tR extends tB.Ce{async sendTransaction(t,e,r={}){let i=!0;try{if(tC(t)){if(!this.supportedTransactionVersions)throw new tT.UF("Sending versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(t.version))throw new tT.UF(`Sending transaction version ${t.version} isn't supported by this wallet`);try{let i=(t=await this.signTransaction(t)).serialize();return await e.sendRawTransaction(i,r)}catch(t){if(t instanceof tT.z4)throw i=!1,t;throw new tT.UF(t?.message,t)}}try{let{signers:i,...n}=r;t=await this.prepareTransaction(t,e,n),i?.length&&t.partialSign(...i);let s=(t=await this.signTransaction(t)).serialize();return await e.sendRawTransaction(s,n)}catch(t){if(t instanceof tT.z4)throw i=!1,t;throw new tT.UF(t?.message,t)}}catch(t){throw i&&this.emit("error",t),t}}async signAllTransactions(t){for(let e of t)if(tC(e)){if(!this.supportedTransactionVersions)throw new tT.z4("Signing versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(e.version))throw new tT.z4(`Signing transaction version ${e.version} isn't supported by this wallet`)}let e=[];for(let r of t)e.push(await this.signTransaction(r));return e}}class tP extends tR{}class tL extends tP{}var tU=r(4763);let tO="solana:signIn",tW="solana:signMessage",tz="solana:signAndSendTransaction",tN="solana:signTransaction";r(8817);let tj=`(?:\\nURI: (?<uri>[^\\n]+))?(?:\\nVersion: (?<version>[^\\n]+))?(?:\\nChain ID: (?<chainId>[^\\n]+))?(?:\\nNonce: (?<nonce>[^\\n]+))?(?:\\nIssued At: (?<issuedAt>[^\\n]+))?(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?(?:\\nNot Before: (?<notBefore>[^\\n]+))?(?:\\nRequest ID: (?<requestId>[^\\n]+))?(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?`;RegExp(`^(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n(?<address>[^\\n]+)(?:\\n|$)(?:\\n(?<statement>[\\S\\s]*?)(?:\\n|$))??${tj}\\n*$`);let tK="ERROR_FORBIDDEN_WALLET_BASE_URL";class tq extends Error{constructor(...t){const[e,r,i]=t;super(r),this.code=e,this.data=i,this.name="SolanaMobileWalletAdapterError"}}class tD extends Error{constructor(...t){const[e,r,i,n]=t;super(i),this.code=r,this.data=n,this.jsonRpcMessageId=e,this.name="SolanaMobileWalletAdapterProtocolError"}}function t$(t,e,r,i){return new(r||(r=Promise))(function(n,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?n(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(o,a)}u((i=i.apply(t,e||[])).next())})}function tF(t,e){let r=window.btoa(String.fromCharCode.call(null,...t));return e?r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):r}function tH(t){return new Uint8Array(window.atob(t).split("").map(t=>t.charCodeAt(0)))}function tV(t,e){return t$(this,void 0,void 0,function*(){let r=yield crypto.subtle.exportKey("raw",t),i=yield crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},e,r),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(new Uint8Array(r),0),n.set(new Uint8Array(i),r.byteLength),n})}let tJ="solana:cloneAuthorization";function tY(t,e){return t$(this,void 0,void 0,function*(){let r=t.slice(0,4),n=t.slice(4,16),s=t.slice(16),o=yield crypto.subtle.decrypt(tZ(r,n),e,s);return(void 0===i&&(i=new TextDecoder("utf-8")),i).decode(o)})}function tZ(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function tG(){return t$(this,void 0,void 0,function*(){return yield crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"])})}function tQ(t){if(t<49152||t>65535)throw new tq("ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",`Association port number must be between 49152 and 65535. ${t} given.`,{port:t});return t}function tX(t){return t.replace(/(^\/+|\/+$)/g,"").split("/")}let t0=null,t1=[150,150,200,500,500,750,750,1e3];function t2(t){return new DataView(t).getUint32(0,!1)}let t6="standard:connect",t3="standard:disconnect",t8="standard:events";var t5=r(9774),t4=r(1899);function t9(t,e,r,i){return new(r||(r=Promise))(function(n,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?n(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(o,a)}u((i=i.apply(t,e||[])).next())})}function t7(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)}function et(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r}let ee=`
|
|
7
|
+
`+s+o;break;default:n=`Unknown action '${t}'`}super(n),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=r,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(null==t||"object"!=typeof t||!("then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,r)=>{t.getTransaction(this.signature).then(t=>{if(t&&t.meta&&t.meta.logMessages){let r=t.meta.logMessages;this.transactionLogs=r,e(r)}else r(Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}class tL extends Error{constructor({code:t,message:e,data:r},i){super(null!=i?`${i}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=r,this.name="SolanaJSONRPCError"}}async function tU(t,e,r,i){let n,s=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},o=await t.sendTransaction(e,r,s);if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)n=(await t.confirmTransaction({abortSignal:i?.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},i&&i.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){let{nonceInstruction:r}=e.nonceInfo,s=r.keys[0].pubkey;n=(await t.confirmTransaction({abortSignal:i?.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:s,nonceValue:e.nonceInfo.nonce,signature:o},i&&i.commitment)).value}else i?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),n=(await t.confirmTransaction(o,i&&i.commitment)).value;if(n.err){if(null!=o)throw new tP({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(n)})`});throw Error(`Transaction ${o} failed (${JSON.stringify(n)})`)}return o}function tO(t){return new Promise(e=>setTimeout(e,t))}function tW(t,e){let r=t.layout.span>=0?t.layout.span:function t(e,r){let i=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(r[e.property]);if("count"in e&&"elementLayout"in e){let t=r[e.property];if(Array.isArray(t))return t.length*i(e.elementLayout)}else if("fields"in e)return t({layout:e},r[e.property]);return 0},n=0;return e.layout.fields.forEach(t=>{n+=i(t)}),n}(t,e),i=a.Buffer.alloc(r),n=Object.assign({instruction:t.index},e);return t.layout.encode(n,i),i}let tz=g.nu64("lamportsPerSignature"),tN=g.struct([g.u32("version"),g.u32("state"),tf("authorizedPubkey"),tf("nonce"),g.struct([tz],"feeCalculator")]),tj=tN.span;class tK{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){let e=tN.decode(ti(t),0);return new tK({authorizedPubkey:new ta(e.authorizedPubkey),nonce:new ta(e.nonce).toString(),feeCalculator:e.feeCalculator})}}function tq(t){let e=(0,g.blob)(8,t),r=e.decode.bind(e),i=e.encode.bind(e),n=((t={})=>(function(t,e){if(w(t)!==w(e))throw new y(8078004);if(w(t)&&w(e)&&t.fixedSize!==e.fixedSize)throw new y(8078005,{decoderFixedSize:e.fixedSize,encoderFixedSize:t.fixedSize});if(!w(t)&&!w(e)&&t.maxSize!==e.maxSize)throw new y(8078006,{decoderMaxSize:e.maxSize,encoderMaxSize:t.maxSize});return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}})(((t={})=>{var e,r;return Object.freeze({...r={fixedSize:(e={config:t,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}).size,write(t,r,i){e.range&&function(t,e,r,i){if(i<e||i>r)throw new y(8078011,{codecDescription:t,max:r,min:e,value:i})}(e.name,e.range[0],e.range[1],t);let n=new ArrayBuffer(e.size);return e.set(new DataView(n),t,b(e.config)),r.set(new Uint8Array(n),i),i+e.size}},encode:t=>{let e=new Uint8Array("fixedSize"in r?r.fixedSize:r.getSizeFromValue(t));return r.write(t,e,0),e}})})(t),((t={})=>{var e,r;return Object.freeze({...r={fixedSize:(e={config:t,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}).size,read(t,r=0){var i,n,s;let o,a;!function(t,e,r=0){if(e.length-r<=0)throw new y(8078e3,{codecDescription:t})}(e.name,t,r),function(t,e,r,i=0){let n=r.length-i;if(n<e)throw new y(8078001,{bytesLength:n,codecDescription:t,expected:e})}(e.name,e.size,t,r);let u=new DataView((i=t,n=r,s=e.size,o=i.byteOffset+(n??0),a=s??i.byteLength,i.buffer.slice(o,o+a)));return[e.get(u,b(e.config)),r+e.size]}},decode:(t,e=0)=>r.read(t,e)[0]})})(t)))();return e.decode=(t,e)=>{let i=r(t,e);return n.decode(i)},e.encode=(t,e,r)=>i(n.encode(t),e,r),e}let tD=Object.freeze({Create:{index:0,layout:g.struct([g.u32("instruction"),g.ns64("lamports"),g.ns64("space"),tf("programId")])},Assign:{index:1,layout:g.struct([g.u32("instruction"),tf("programId")])},Transfer:{index:2,layout:g.struct([g.u32("instruction"),tq("lamports")])},CreateWithSeed:{index:3,layout:g.struct([g.u32("instruction"),tf("base"),td("seed"),g.ns64("lamports"),g.ns64("space"),tf("programId")])},AdvanceNonceAccount:{index:4,layout:g.struct([g.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:g.struct([g.u32("instruction"),tf("authorized")])},AuthorizeNonceAccount:{index:7,layout:g.struct([g.u32("instruction"),tf("authorized")])},Allocate:{index:8,layout:g.struct([g.u32("instruction"),g.ns64("space")])},AllocateWithSeed:{index:9,layout:g.struct([g.u32("instruction"),tf("base"),td("seed"),g.ns64("space"),tf("programId")])},AssignWithSeed:{index:10,layout:g.struct([g.u32("instruction"),tf("base"),td("seed"),tf("programId")])},TransferWithSeed:{index:11,layout:g.struct([g.u32("instruction"),tq("lamports"),td("seed"),tf("programId")])},UpgradeNonceAccount:{index:12,layout:g.struct([g.u32("instruction")])}});class t${constructor(){}static createAccount(t){let e=tW(tD.Create,{lamports:t.lamports,space:t.space,programId:ti(t.programId.toBuffer())});return new tI({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=tW(tD.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:ti(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=tW(tD.Transfer,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new tI({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;return"basePubkey"in t?(e=tW(tD.AssignWithSeed,{base:ti(t.basePubkey.toBuffer()),seed:t.seed,programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=tW(tD.Assign,{programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tI({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=tW(tD.CreateWithSeed,{base:ti(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||r.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new tI({keys:r,programId:this.programId,data:e})}static createNonceAccount(t){let e=new tx;"basePubkey"in t&&"seed"in t?e.add(t$.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:tj,programId:this.programId})):e.add(t$.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:tj,programId:this.programId}));let r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){let e=tW(tD.InitializeNonceAccount,{authorized:ti(t.authorizedPubkey.toBuffer())});return new tI({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tT,isSigner:!1,isWritable:!1},{pubkey:tC,isSigner:!1,isWritable:!1}],programId:this.programId,data:e})}static nonceAdvance(t){let e=tW(tD.AdvanceNonceAccount);return new tI({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tT,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceWithdraw(t){let e=tW(tD.WithdrawNonceAccount,{lamports:t.lamports});return new tI({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:tT,isSigner:!1,isWritable:!1},{pubkey:tC,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){let e=tW(tD.AuthorizeNonceAccount,{authorized:ti(t.newAuthorizedPubkey.toBuffer())});return new tI({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=tW(tD.AllocateWithSeed,{base:ti(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:ti(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=tW(tD.Allocate,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tI({keys:r,programId:this.programId,data:e})}}t$.programId=new ta("11111111111111111111111111111111");class tF{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/tF.chunkSize)+1+1)}static async load(t,e,r,i,n){{let s=await t.getMinimumBalanceForRentExemption(n.length),o=await t.getAccountInfo(r.publicKey,"confirmed"),a=null;if(null!==o){if(o.executable)return console.error("Program load failed, account is already executable"),!1;o.data.length!==n.length&&(a=a||new tx).add(t$.allocate({accountPubkey:r.publicKey,space:n.length})),o.owner.equals(i)||(a=a||new tx).add(t$.assign({accountPubkey:r.publicKey,programId:i})),o.lamports<s&&(a=a||new tx).add(t$.transfer({fromPubkey:e.publicKey,toPubkey:r.publicKey,lamports:s-o.lamports}))}else a=new tx().add(t$.createAccount({fromPubkey:e.publicKey,newAccountPubkey:r.publicKey,lamports:s>0?s:1,space:n.length,programId:i}));null!==a&&await tU(t,a,[e,r],{commitment:"confirmed"})}let s=g.struct([g.u32("instruction"),g.u32("offset"),g.u32("bytesLength"),g.u32("bytesLengthPadding"),g.seq(g.u8("byte"),g.offset(g.u32(),-8),"bytes")]),o=tF.chunkSize,u=0,l=n,c=[];for(;l.length>0;){let n=l.slice(0,o),h=a.Buffer.alloc(o+16);s.encode({instruction:0,offset:u,bytes:n,bytesLength:0,bytesLengthPadding:0},h);let f=new tx().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:h});c.push(tU(t,f,[e,r],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await tO(250),u+=o,l=l.slice(o)}await Promise.all(c);{let n=g.struct([g.u32("instruction")]),s=a.Buffer.alloc(n.span);n.encode({instruction:1},s);let o=new tx().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:tC,isSigner:!1,isWritable:!1}],programId:i,data:s}),u="processed",l=await t.sendTransaction(o,[e,r],{preflightCommitment:u}),{context:c,value:h}=await t.confirmTransaction({signature:l,lastValidBlockHeight:o.lastValidBlockHeight,blockhash:o.recentBlockhash},u);if(h.err)throw Error(`Transaction ${l} failed (${JSON.stringify(h)})`);for(;;){try{if(await t.getSlot({commitment:u})>c.slot)break}catch{}await new Promise(t=>setTimeout(t,Math.round(200)))}}return!0}}tF.chunkSize=932,new ta("BPFLoader2111111111111111111111111111111111");var tH=(n=function(){if(o)return s;o=1;var t=Object.prototype.toString,e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};return s=function(r){var i=function r(i,n){var s,o,a,u,l,c,h;if(!0===i)return"true";if(!1===i)return"false";switch(typeof i){case"object":if(null===i)return null;if(i.toJSON&&"function"==typeof i.toJSON)return r(i.toJSON(),n);if("[object Array]"===(h=t.call(i))){for(s=0,a="[",o=i.length-1;s<o;s++)a+=r(i[s],!0)+",";return o>-1&&(a+=r(i[s],!0)),a+"]"}if("[object Object]"!==h)return JSON.stringify(i);for(o=(u=e(i).sort()).length,a="",s=0;s<o;)void 0!==(c=r(i[l=u[s]],!1))&&(a&&(a+=","),a+=JSON.stringify(l)+":"+c),s++;return"{"+a+"}";case"function":case"undefined":return n?null:void 0;case"string":return JSON.stringify(i);default:return isFinite(i)?i:null}}(r,!1);if(void 0!==i)return""+i}}())&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;function tV(t){let e=0;for(;t>1;)t/=2,e++;return e}class tJ{constructor(t,e,r,i,n){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=n}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){var e;let r=tV(0===(e=t+32+1)?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,(e|=e>>32)+1))-tV(32)-1,i=this.getSlotsInEpoch(r);return[r,t-(i-32)]}{let e=t-this.firstNormalSlot,r=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+r,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?(Math.pow(2,t)-1)*32:(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+tV(32)):this.slotsPerEpoch}}var tY=globalThis.fetch;class tZ extends Y{constructor(t,e,r){super(t=>{let r=new V(t,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return"socket"in r?this.underlyingSocket=r.socket:this.underlyingSocket=r,r},t,e,r),this.underlyingSocket=void 0}call(...t){let e=this.underlyingSocket?.readyState;return 1===e?super.call(...t):Promise.reject(Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){let e=this.underlyingSocket?.readyState;return 1===e?super.notify(...t):Promise.reject(Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class tG{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){let t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){let e=function(t,e){let r;try{r=t.layout.decode(e)}catch(t){throw Error("invalid instruction; "+t)}if(r.typeIndex!==t.index)throw Error(`invalid account data; account type mismatch ${r.typeIndex} != ${t.index}`);return r}(tQ,t),r=t.length-56;tm(r>=0,"lookup table is invalid"),tm(r%32==0,"lookup table is invalid");let{addresses:i}=g.struct([g.seq(tf(),r/32,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new ta(e.authority[0]):void 0,addresses:i.map(t=>new ta(t))}}}let tQ={index:1,layout:g.struct([g.u32("typeIndex"),tq("deactivationSlot"),g.nu64("lastExtendedSlot"),g.u8("lastExtendedStartIndex"),g.u8(),g.seq(tf(),g.offset(g.u8(),-1),"authority")])},tX=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,t0=D(R(ta),z(),t=>new ta(t)),t1=N([z(),P("base64")]),t2=D(R(a.Buffer),t1,t=>a.Buffer.from(t[0],"base64"));function t6(t){let e,r;if("string"==typeof t)e=t;else if(t){let{commitment:i,...n}=t;e=i,r=n}return{commitment:e,config:r}}function t3(t){return t.map(t=>"memcmp"in t?{...t,memcmp:{...t.memcmp,encoding:t.memcmp.encoding??"base58"}}:t)}function t8(t){return K([j({jsonrpc:P("2.0"),id:z(),result:t}),j({jsonrpc:P("2.0"),id:z(),error:j({code:q(),message:z(),data:O(B("any",()=>!0))})})])}let t5=t8(q());function t4(t){return D(t8(t),t5,e=>"error"in e?e:{...e,result:x(e.result,t)})}function t9(t){return t4(j({context:j({slot:U()}),value:t}))}function t7(t){return j({context:j({slot:U()}),value:t})}function et(t,e){return 0===t?new tS({header:e.header,staticAccountKeys:e.accountKeys.map(t=>new ta(t)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:f().decode(t.data)})),addressTableLookups:e.addressTableLookups}):new tk(e)}let ee=j({foundation:U(),foundationTerm:U(),initial:U(),taper:U(),terminal:U()}),er=t4(T(L(j({epoch:U(),effectiveSlot:U(),amount:U(),postBalance:U(),commission:O(L(U()))})))),ei=T(j({slot:U(),prioritizationFee:U()})),en=j({total:U(),validator:U(),foundation:U(),epoch:U()}),es=j({epoch:U(),slotIndex:U(),slotsInEpoch:U(),absoluteSlot:U(),blockHeight:O(U()),transactionCount:O(U())}),eo=j({slotsPerEpoch:U(),leaderScheduleSlotOffset:U(),warmup:C(),firstNormalEpoch:U(),firstNormalSlot:U()}),ea=W(z(),T(U())),eu=L(K([j({}),z()])),el=j({err:eu}),ec=P("receivedSignature"),eh=j({"solana-core":z(),"feature-set":O(U())}),ef=j({program:z(),programId:t0,parsed:q()}),ed=j({programId:t0,accounts:T(t0),data:z()}),ep=t9(j({err:L(K([j({}),z()])),logs:L(T(z())),accounts:O(L(T(L(j({executable:C(),owner:z(),lamports:U(),data:T(z()),rentEpoch:O(U())}))))),unitsConsumed:O(U()),returnData:O(L(j({programId:z(),data:N([z(),P("base64")])}))),innerInstructions:O(L(T(j({index:U(),instructions:T(K([ef,ed]))}))))})),eg=t9(j({byIdentity:W(z(),T(U())),range:j({firstSlot:U(),lastSlot:U()})})),em=t4(ee),ey=t4(en),ew=t4(ei),eb=t4(es),ev=t4(eo),ek=t4(ea),eS=t4(U()),eE=t9(j({total:U(),circulating:U(),nonCirculating:U(),nonCirculatingAccounts:T(t0)})),eM=j({amount:z(),uiAmount:L(U()),decimals:U(),uiAmountString:O(z())}),eA=t9(T(j({address:t0,amount:z(),uiAmount:L(U()),decimals:U(),uiAmountString:O(z())}))),eI=t9(T(j({pubkey:t0,account:j({executable:C(),owner:t0,lamports:U(),data:t2,rentEpoch:U()})}))),ex=j({program:z(),parsed:q(),space:U()}),e_=t9(T(j({pubkey:t0,account:j({executable:C(),owner:t0,lamports:U(),data:ex,rentEpoch:U()})}))),eB=t9(T(j({lamports:U(),address:t0}))),eT=j({executable:C(),owner:t0,lamports:U(),data:t2,rentEpoch:U()}),eC=j({pubkey:t0,account:eT}),eR=D(K([R(a.Buffer),ex]),K([t1,ex]),t=>Array.isArray(t)?x(t,t2):t),eP=j({executable:C(),owner:t0,lamports:U(),data:eR,rentEpoch:U()}),eL=j({pubkey:t0,account:eP}),eU=j({state:K([P("active"),P("inactive"),P("activating"),P("deactivating")]),active:U(),inactive:U()}),eO=t4(T(j({signature:z(),slot:U(),err:eu,memo:L(z()),blockTime:O(L(U()))}))),eW=t4(T(j({signature:z(),slot:U(),err:eu,memo:L(z()),blockTime:O(L(U()))}))),ez=j({subscription:U(),result:t7(eT)}),eN=j({pubkey:t0,account:eT}),ej=j({subscription:U(),result:t7(eN)}),eK=j({parent:U(),slot:U(),root:U()}),eq=j({subscription:U(),result:eK}),eD=K([j({type:K([P("firstShredReceived"),P("completed"),P("optimisticConfirmation"),P("root")]),slot:U(),timestamp:U()}),j({type:P("createdBank"),parent:U(),slot:U(),timestamp:U()}),j({type:P("frozen"),slot:U(),timestamp:U(),stats:j({numTransactionEntries:U(),numSuccessfulTransactions:U(),numFailedTransactions:U(),maxTransactionsPerEntry:U()})}),j({type:P("dead"),slot:U(),timestamp:U(),err:z()})]),e$=j({subscription:U(),result:eD}),eF=j({subscription:U(),result:t7(K([el,ec]))}),eH=j({subscription:U(),result:U()}),eV=j({pubkey:z(),gossip:L(z()),tpu:L(z()),rpc:L(z()),version:L(z())}),eJ=j({votePubkey:z(),nodePubkey:z(),activatedStake:U(),epochVoteAccount:C(),epochCredits:T(N([U(),U(),U()])),commission:U(),lastVote:U(),rootSlot:L(U())}),eY=t4(j({current:T(eJ),delinquent:T(eJ)})),eZ=K([P("processed"),P("confirmed"),P("finalized")]),eG=j({slot:U(),confirmations:L(U()),err:eu,confirmationStatus:O(eZ)}),eQ=t9(T(L(eG))),eX=t4(U()),e0=j({accountKey:t0,writableIndexes:T(U()),readonlyIndexes:T(U())}),e1=j({signatures:T(z()),message:j({accountKeys:T(z()),header:j({numRequiredSignatures:U(),numReadonlySignedAccounts:U(),numReadonlyUnsignedAccounts:U()}),instructions:T(j({accounts:T(U()),data:z(),programIdIndex:U()})),recentBlockhash:z(),addressTableLookups:O(T(e0))})}),e2=j({pubkey:t0,signer:C(),writable:C(),source:O(K([P("transaction"),P("lookupTable")]))}),e6=j({accountKeys:T(e2),signatures:T(z())}),e3=j({parsed:q(),program:z(),programId:t0}),e8=j({accounts:T(t0),data:z(),programId:t0}),e5=D(K([e8,e3]),K([j({parsed:q(),program:z(),programId:z()}),j({accounts:T(z()),data:z(),programId:z()})]),t=>"accounts"in t?x(t,e8):x(t,e3)),e4=j({signatures:T(z()),message:j({accountKeys:T(e2),instructions:T(e5),recentBlockhash:z(),addressTableLookups:O(L(T(e0)))})}),e9=j({accountIndex:U(),mint:z(),owner:O(z()),programId:O(z()),uiTokenAmount:eM}),e7=j({writable:T(t0),readonly:T(t0)}),rt=j({err:eu,fee:U(),innerInstructions:O(L(T(j({index:U(),instructions:T(j({accounts:T(U()),data:z(),programIdIndex:U()}))})))),preBalances:T(U()),postBalances:T(U()),logMessages:O(L(T(z()))),preTokenBalances:O(L(T(e9))),postTokenBalances:O(L(T(e9))),loadedAddresses:O(e7),computeUnitsConsumed:O(U()),costUnits:O(U())}),re=j({err:eu,fee:U(),innerInstructions:O(L(T(j({index:U(),instructions:T(e5)})))),preBalances:T(U()),postBalances:T(U()),logMessages:O(L(T(z()))),preTokenBalances:O(L(T(e9))),postTokenBalances:O(L(T(e9))),loadedAddresses:O(e7),computeUnitsConsumed:O(U()),costUnits:O(U())}),rr=K([P(0),P("legacy")]),ri=j({pubkey:z(),lamports:U(),postBalance:L(U()),rewardType:L(z()),commission:O(L(U()))}),rn=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e1,meta:L(rt),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),rs=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),ro=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e6,meta:L(rt),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),ra=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e4,meta:L(re),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),ru=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e6,meta:L(re),version:O(rr)})),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),rl=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),rewards:O(T(ri)),blockTime:L(U()),blockHeight:L(U())}))),rc=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),transactions:T(j({transaction:e1,meta:L(rt)})),rewards:O(T(ri)),blockTime:L(U())}))),rh=t4(L(j({blockhash:z(),previousBlockhash:z(),parentSlot:U(),signatures:T(z()),blockTime:L(U())}))),rf=t4(L(j({slot:U(),meta:L(rt),blockTime:O(L(U())),transaction:e1,version:O(rr)}))),rd=t4(L(j({slot:U(),transaction:e4,meta:L(re),blockTime:O(L(U())),version:O(rr)}))),rp=t9(j({blockhash:z(),lastValidBlockHeight:U()})),rg=t9(C()),rm=t4(T(j({slot:U(),numTransactions:U(),numSlots:U(),samplePeriodSecs:U()}))),ry=t9(L(j({feeCalculator:j({lamportsPerSignature:U()})}))),rw=t4(z()),rb=t4(z()),rv=j({err:eu,logs:T(z()),signature:z()}),rk=j({result:t7(rv),subscription:U()}),rS={"solana-client":"js/1.0.0-maintenance"};class rE{constructor(t,e){var r;let i,n,s,o,a,u;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{let t={};return async e=>{let{commitment:r,config:i}=t6(e),n=this._buildArgs([],r,void 0,i),s=tH(n);return t[s]=t[s]??(async()=>{try{let t=await this._rpcRequest("getBlockHeight",n),e=x(t,t4(U()));if("error"in e)throw new tL(e.error,"failed to get block height information");return e.result}finally{delete t[s]}})(),await t[s]}})(),e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,i=e.wsEndpoint,n=e.httpHeaders,s=e.fetch,o=e.fetchMiddleware,a=e.disableRetryOnRateLimit,u=e.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(t),this._rpcWsEndpoint=i||function(t){let e=t.match(tX);if(null==e)throw TypeError(`Failed to validate endpoint URL \`${t}\``);let[r,i,n,s]=e,o=t.startsWith("https:")?"wss:":"ws:",a=null==n?null:parseInt(n.slice(1),10),u=null==a?"":`:${a+1}`;return`${o}//${i}${u}${s}`}(t),this._rpcClient=function(t,e,r,i,n,s){let o,a,u=r||tY;return null!=s&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),i&&(a=async(t,e)=>{let r=await new Promise((r,n)=>{try{i(t,e,(t,e)=>r([t,e]))}catch(t){n(t)}});return await u(...r)}),new(F())(async(r,i)=>{let s={method:"POST",body:r,agent:o,headers:Object.assign({"Content-Type":"application/json"},e||{},rS)};try{let e,r=5,o=500;for(;(e=a?await a(t,s):await u(t,s),429===e.status&&!0!==n)&&(r-=1,0!==r);){;console.error(`Server responded with ${e.status} ${e.statusText}. Retrying after ${o}ms delay...`),await tO(o),o*=2}let l=await e.text();e.ok?i(null,l):i(Error(`${e.status} ${e.statusText}: ${l}`))}catch(t){t instanceof Error&&i(t)}},{})}(t,n,s,o,a,u),this._rpcRequest=(r=this._rpcClient,(t,e)=>new Promise((i,n)=>{r.request(t,e,(t,e)=>{t?n(t):i(e)})})),this._rpcBatchRequest=function(t){return e=>new Promise((r,i)=>{0===e.length&&r([]);let n=e.map(e=>t.request(e.methodName,e.args));t.request(n,(t,e)=>{t?i(t):r(e)})})}(this._rpcClient),this._rpcWebSocket=new tZ(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,void 0,i),s=x(await this._rpcRequest("getBalance",n),t9(U()));if("error"in s)throw new tL(s.error,`failed to get balance for ${t.toBase58()}`);return s.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then(t=>t.value).catch(e=>{throw Error("failed to get balance of account "+t.toBase58()+": "+e)})}async getBlockTime(t){let e=x(await this._rpcRequest("getBlockTime",[t]),t4(L(U())));if("error"in e)throw new tL(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){let t=x(await this._rpcRequest("minimumLedgerSlot",[]),t4(U()));if("error"in t)throw new tL(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){let t=x(await this._rpcRequest("getFirstAvailableBlock",[]),eS);if("error"in t)throw new tL(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};let r=x(await this._rpcRequest("getSupply",[e]),eE);if("error"in r)throw new tL(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){let r=this._buildArgs([t.toBase58()],e),i=x(await this._rpcRequest("getTokenSupply",r),t9(eM));if("error"in i)throw new tL(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(t,e){let r=this._buildArgs([t.toBase58()],e),i=x(await this._rpcRequest("getTokenAccountBalance",r),t9(eM));if("error"in i)throw new tL(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(t,e,r){let{commitment:i,config:n}=t6(r),s=[t.toBase58()];"mint"in e?s.push({mint:e.mint.toBase58()}):s.push({programId:e.programId.toBase58()});let o=this._buildArgs(s,i,"base64",n),a=x(await this._rpcRequest("getTokenAccountsByOwner",o),eI);if("error"in a)throw new tL(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(t,e,r){let i=[t.toBase58()];"mint"in e?i.push({mint:e.mint.toBase58()}):i.push({programId:e.programId.toBase58()});let n=this._buildArgs(i,r,"jsonParsed"),s=x(await this._rpcRequest("getTokenAccountsByOwner",n),e_);if("error"in s)throw new tL(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getLargestAccounts(t){let e={...t,commitment:t&&t.commitment||this.commitment},r=e.filter||e.commitment?[e]:[],i=x(await this._rpcRequest("getLargestAccounts",r),eB);if("error"in i)throw new tL(i.error,"failed to get largest accounts");return i.result}async getTokenLargestAccounts(t,e){let r=this._buildArgs([t.toBase58()],e),i=x(await this._rpcRequest("getTokenLargestAccounts",r),eA);if("error"in i)throw new tL(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,"base64",i),s=x(await this._rpcRequest("getAccountInfo",n),t9(L(eT)));if("error"in s)throw new tL(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getParsedAccountInfo(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,"jsonParsed",i),s=x(await this._rpcRequest("getAccountInfo",n),t9(L(eP)));if("error"in s)throw new tL(s.error,`failed to get info about account ${t.toBase58()}`);return s.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleParsedAccounts(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>t.toBase58()),s=this._buildArgs([n],r,"jsonParsed",i),o=x(await this._rpcRequest("getMultipleAccounts",s),t9(T(L(eP))));if("error"in o)throw new tL(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfoAndContext(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>t.toBase58()),s=this._buildArgs([n],r,"base64",i),o=x(await this._rpcRequest("getMultipleAccounts",s),t9(T(L(eT))));if("error"in o)throw new tL(o.error,`failed to get info for accounts ${n}`);return o.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,r){let{commitment:i,config:n}=t6(e),s=this._buildArgs([t.toBase58()],i,void 0,{...n,epoch:null!=r?r:n?.epoch}),o=x(await this._rpcRequest("getStakeActivation",s),t4(eU));if("error"in o)throw new tL(o.error,`failed to get Stake Activation ${t.toBase58()}`);return o.result}async getProgramAccounts(t,e){let{commitment:r,config:i}=t6(e),{encoding:n,...s}=i||{},o=this._buildArgs([t.toBase58()],r,n||"base64",{...s,...s.filters?{filters:t3(s.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",o),u=T(eC),l=!0===s.withContext?x(a,t9(u)):x(a,t4(u));if("error"in l)throw new tL(l.error,`failed to get accounts owned by program ${t.toBase58()}`);return l.result}async getParsedProgramAccounts(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t.toBase58()],r,"jsonParsed",i),s=x(await this._rpcRequest("getProgramAccounts",n),t4(T(eL)));if("error"in s)throw new tL(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async confirmTransaction(t,e){let r,i;if("string"==typeof t)r=t;else{if(t.abortSignal?.aborted)return Promise.reject(t.abortSignal.reason);r=t.signature}try{i=f().decode(r)}catch(t){throw Error("signature must be base58 encoded: "+r)}return(tm(64===i.length,"signature has invalid length"),"string"==typeof t)?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:r}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise((e,r)=>{null!=t&&(t.aborted?r(t.reason):t.addEventListener("abort",()=>{r(t.reason)}))})}getTransactionConfirmationPromise({commitment:t,signature:e}){let r,i,n=!1;return{abortConfirmation:()=>{i&&(i(),i=void 0),null!=r&&(this.removeSignatureListener(r),r=void 0)},confirmationPromise:new Promise((s,o)=>{try{r=this.onSignature(e,(t,e)=>{r=void 0,s({__type:tM.PROCESSED,response:{context:e,value:t}})},t);let a=new Promise(t=>{null==r?t():i=this._onSubscriptionStateChange(r,e=>{"subscribed"===e&&t()})});(async()=>{if(await a,n)return;let r=await this.getSignatureStatus(e);if(n||null==r)return;let{context:i,value:u}=r;if(null!=u)if(u?.err)o(u.err);else{switch(t){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}n=!0,s({__type:tM.PROCESSED,response:{context:i,value:u}})}})()}catch(t){o(t)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:r,signature:i}}){let n,s=!1,o=new Promise(e=>{let i=async()=>{try{return await this.getBlockHeight(t)}catch(t){return -1}};(async()=>{let t=await i();if(!s){for(;t<=r;)if(await tO(1e3),s||(t=await i(),s))return;e({__type:tM.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),l=this.getCancellationPromise(e);try{let t=await Promise.race([l,u,o]);if(t.__type===tM.PROCESSED)n=t.response;else throw new tu(i)}finally{s=!0,a()}return n}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:r,nonceAccountPubkey:i,nonceValue:n,signature:s}}){let o,a=!1,u=new Promise(e=>{let s=n,o=null,u=async()=>{try{let{context:e,value:n}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:r});return o=e.slot,n?.nonce}catch(t){return s}};(async()=>{if(s=await u(),!a)for(;;){if(n!==s)return void e({__type:tM.NONCE_INVALID,slotInWhichNonceDidAdvance:o});if(await tO(2e3),a||(s=await u(),a))return}})()}),{abortConfirmation:l,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:s}),h=this.getCancellationPromise(e);try{let e=await Promise.race([h,c,u]);if(e.__type===tM.PROCESSED)o=e.response;else{let i;for(;;){let t=await this.getSignatureStatus(s);if(null==t)break;if(t.context.slot<(e.slotInWhichNonceDidAdvance??r)){await tO(400);continue}i=t;break}if(i?.value){let e=t||"finalized",{confirmationStatus:r}=i.value;switch(e){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new tc(s);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new tc(s);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new tc(s)}o={context:i.context,value:{err:i.value.err}}}else throw new tc(s)}}finally{a=!0,l()}return o}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let r,i,n=new Promise(e=>{let i=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":i=this._confirmTransactionInitialTimeout||3e4}r=setTimeout(()=>e({__type:tM.TIMED_OUT,timeoutMs:i}),i)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:e});try{let t=await Promise.race([o,n]);if(t.__type===tM.PROCESSED)i=t.response;else throw new tl(e,t.timeoutMs/1e3)}finally{clearTimeout(r),s()}return i}async getClusterNodes(){let t=x(await this._rpcRequest("getClusterNodes",[]),t4(T(eV)));if("error"in t)throw new tL(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){let e=this._buildArgs([],t),r=x(await this._rpcRequest("getVoteAccounts",e),eY);if("error"in r)throw new tL(r.error,"failed to get vote accounts");return r.result}async getSlot(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getSlot",i),t4(U()));if("error"in n)throw new tL(n.error,"failed to get slot");return n.result}async getSlotLeader(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getSlotLeader",i),t4(z()));if("error"in n)throw new tL(n.error,"failed to get slot leader");return n.result}async getSlotLeaders(t,e){let r=x(await this._rpcRequest("getSlotLeaders",[t,e]),t4(T(t0)));if("error"in r)throw new tL(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){let{context:r,value:i}=await this.getSignatureStatuses([t],e);return tm(1===i.length),{context:r,value:i[0]}}async getSignatureStatuses(t,e){let r=[t];e&&r.push(e);let i=x(await this._rpcRequest("getSignatureStatuses",r),eQ);if("error"in i)throw new tL(i.error,"failed to get signature status");return i.result}async getTransactionCount(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getTransactionCount",i),t4(U()));if("error"in n)throw new tL(n.error,"failed to get transaction count");return n.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){let e=this._buildArgs([],t),r=x(await this._rpcRequest("getInflationGovernor",e),em);if("error"in r)throw new tL(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,r){let{commitment:i,config:n}=t6(r),s=this._buildArgs([t.map(t=>t.toBase58())],i,void 0,{...n,epoch:null!=e?e:n?.epoch}),o=x(await this._rpcRequest("getInflationReward",s),er);if("error"in o)throw new tL(o.error,"failed to get inflation reward");return o.result}async getInflationRate(){let t=x(await this._rpcRequest("getInflationRate",[]),ey);if("error"in t)throw new tL(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getEpochInfo",i),eb);if("error"in n)throw new tL(n.error,"failed to get epoch info");return n.result}async getEpochSchedule(){let t=x(await this._rpcRequest("getEpochSchedule",[]),ev);if("error"in t)throw new tL(t.error,"failed to get epoch schedule");let e=t.result;return new tJ(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){let t=x(await this._rpcRequest("getLeaderSchedule",[]),ek);if("error"in t)throw new tL(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){let r=this._buildArgs([t],e),i=x(await this._rpcRequest("getMinimumBalanceForRentExemption",r),eX);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(t){let{context:e,value:{blockhash:r}}=await this.getLatestBlockhashAndContext(t);return{context:e,value:{blockhash:r,feeCalculator:{get lamportsPerSignature(){throw Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(t){let e=x(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),rm);if("error"in e)throw new tL(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){let r=this._buildArgs([t],e),i=x(await this._rpcRequest("getFeeCalculatorForBlockhash",r),ry);if("error"in i)throw new tL(i.error,"failed to get fee calculator");let{context:n,value:s}=i.result;return{context:n,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(t,e){let r=ti(t.serialize()).toString("base64"),i=this._buildArgs([r],e),n=x(await this._rpcRequest("getFeeForMessage",i),t9(L(U())));if("error"in n)throw new tL(n.error,"failed to get fee for message");if(null===n.result)throw Error("invalid blockhash");return n.result}async getRecentPrioritizationFees(t){let e=t?.lockedWritableAccounts?.map(t=>t.toBase58()),r=e?.length?[e]:[],i=x(await this._rpcRequest("getRecentPrioritizationFees",r),ew);if("error"in i)throw new tL(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,void 0,r),n=x(await this._rpcRequest("getLatestBlockhash",i),rp);if("error"in n)throw new tL(n.error,"failed to get latest blockhash");return n.result}async isBlockhashValid(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgs([t],r,void 0,i),s=x(await this._rpcRequest("isBlockhashValid",n),rg);if("error"in s)throw new tL(s.error,"failed to determine if the blockhash `"+t+"`is valid");return s.result}async getVersion(){let t=x(await this._rpcRequest("getVersion",[]),t4(eh));if("error"in t)throw new tL(t.error,"failed to get version");return t.result}async getGenesisHash(){let t=x(await this._rpcRequest("getGenesisHash",[]),t4(z()));if("error"in t)throw new tL(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,void 0,i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let t=x(s,ro);if("error"in t)throw t.error;return t.result}case"none":{let t=x(s,rs);if("error"in t)throw t.error;return t.result}default:{let t=x(s,rn);if("error"in t)throw t.error;let{result:e}=t;return e?{...e,transactions:e.transactions.map(({transaction:t,meta:e,version:r})=>({meta:e,transaction:{...t,message:et(r,t.message)},version:r}))}:null}}}catch(t){throw new tL(t,"failed to get confirmed block")}}async getParsedBlock(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),s=await this._rpcRequest("getBlock",n);try{switch(i?.transactionDetails){case"accounts":{let t=x(s,ru);if("error"in t)throw t.error;return t.result}case"none":{let t=x(s,rl);if("error"in t)throw t.error;return t.result}default:{let t=x(s,ra);if("error"in t)throw t.error;return t.result}}}catch(t){throw new tL(t,"failed to get block")}}async getBlockProduction(t){let e,r;if("string"==typeof t)r=t;else if(t){let{commitment:i,...n}=t;r=i,e=n}let i=this._buildArgs([],r,"base64",e),n=x(await this._rpcRequest("getBlockProduction",i),eg);if("error"in n)throw new tL(n.error,"failed to get block production information");return n.result}async getTransaction(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,void 0,i),s=x(await this._rpcRequest("getTransaction",n),rf);if("error"in s)throw new tL(s.error,"failed to get transaction");let o=s.result;return o?{...o,transaction:{...o.transaction,message:et(o.version,o.transaction.message)}}:o}async getParsedTransaction(t,e){let{commitment:r,config:i}=t6(e),n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),s=x(await this._rpcRequest("getTransaction",n),rd);if("error"in s)throw new tL(s.error,"failed to get transaction");return s.result}async getParsedTransactions(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i)}));return(await this._rpcBatchRequest(n)).map(t=>{let e=x(t,rd);if("error"in e)throw new tL(e.error,"failed to get transactions");return e.result})}async getTransactions(t,e){let{commitment:r,config:i}=t6(e),n=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,void 0,i)}));return(await this._rpcBatchRequest(n)).map(t=>{let e=x(t,rf);if("error"in e)throw new tL(e.error,"failed to get transactions");let r=e.result;return r?{...r,transaction:{...r.transaction,message:et(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=x(await this._rpcRequest("getBlock",r),rc);if("error"in i)throw new tL(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+t+" not found");let s={...n,transactions:n.transactions.map(({transaction:t,meta:e})=>{let r=new tk(t.message);return{meta:e,transaction:{...t,message:r}}})};return{...s,transactions:s.transactions.map(({transaction:t,meta:e})=>({meta:e,transaction:tx.populate(t.message,t.signatures)}))}}async getBlocks(t,e,r){let i=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],r),n=x(await this._rpcRequest("getBlocks",i),t4(T(U())));if("error"in n)throw new tL(n.error,"failed to get blocks");return n.result}async getBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=x(await this._rpcRequest("getBlock",r),rh);if("error"in i)throw new tL(i.error,"failed to get block");let n=i.result;if(!n)throw Error("Block "+t+" not found");return n}async getConfirmedBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=x(await this._rpcRequest("getBlock",r),rh);if("error"in i)throw new tL(i.error,"failed to get confirmed block");let n=i.result;if(!n)throw Error("Confirmed block "+t+" not found");return n}async getConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=x(await this._rpcRequest("getTransaction",r),rf);if("error"in i)throw new tL(i.error,"failed to get transaction");let n=i.result;if(!n)return n;let s=new tk(n.transaction.message),o=n.transaction.signatures;return{...n,transaction:tx.populate(s,o)}}async getParsedConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),i=x(await this._rpcRequest("getTransaction",r),rd);if("error"in i)throw new tL(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(t,e){let r=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(t=>{let e=x(t,rd);if("error"in e)throw new tL(e.error,"failed to get confirmed transactions");return e.result})}async getConfirmedSignaturesForAddress(t,e,r){let i={},n=await this.getFirstAvailableBlock();for(;!("until"in i)&&!(--e<=0)&&!(e<n);)try{let t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(i.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let s=await this.getSlot("finalized");for(;!("before"in i)&&!(++r>s);)try{let t=await this.getConfirmedBlockSignatures(r);t.signatures.length>0&&(i.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,i)).map(t=>t.signature)}async getConfirmedSignaturesForAddress2(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),n=x(await this._rpcRequest("getConfirmedSignaturesForAddress2",i),eO);if("error"in n)throw new tL(n.error,"failed to get confirmed signatures for address");return n.result}async getSignaturesForAddress(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),n=x(await this._rpcRequest("getSignaturesForAddress",i),eW);if("error"in n)throw new tL(n.error,"failed to get signatures for address");return n.result}async getAddressLookupTable(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),n=null;return null!==i&&(n=new tG({key:t,state:tG.deserialize(i.data)})),{context:r,value:n}}async getNonceAndContext(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),n=null;return null!==i&&(n=tK.fromAccountData(i.data)),{context:r,value:n}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then(t=>t.value).catch(e=>{throw Error("failed to get nonce for account "+t.toBase58()+": "+e)})}async requestAirdrop(t,e){let r=x(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),rw);if("error"in r)throw new tL(r.error,`airdrop to ${t.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await tO(100);let t=Date.now()-this._blockhashInfo.lastFetch;if(null!==this._blockhashInfo.latestBlockhash&&!(t>=3e4))return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let t=Date.now(),e=this._blockhashInfo.latestBlockhash,r=e?e.blockhash:null;for(let t=0;t<50;t++){let t=await this.getLatestBlockhash("finalized");if(r!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await tO(200)}throw Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){let{commitment:e,config:r}=t6(t),i=this._buildArgs([],e,"base64",r),n=x(await this._rpcRequest("getStakeMinimumDelegation",i),t9(U()));if("error"in n)throw new tL(n.error,"failed to get stake minimum delegation");return n.result}async simulateTransaction(t,e,r){let i;if("message"in t){let i=t.serialize(),n=a.Buffer.from(i).toString("base64");if(Array.isArray(e)||void 0!==r)throw Error("Invalid arguments");let s=e||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment),e&&"object"==typeof e&&"innerInstructions"in e&&(s.innerInstructions=e.innerInstructions);let o=[n,s],u=x(await this._rpcRequest("simulateTransaction",o),ep);if("error"in u)throw Error("failed to simulate transaction: "+u.error.message);return u.result}if(t instanceof tx?((i=new tx).feePayer=t.feePayer,i.instructions=t.instructions,i.nonceInfo=t.nonceInfo,i.signatures=t.signatures):(i=tx.populate(t))._message=i._json=void 0,void 0!==e&&!Array.isArray(e))throw Error("Invalid arguments");if(i.nonceInfo&&e)i.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){let r=await this._blockhashWithExpiryBlockHeight(t);if(i.lastValidBlockHeight=r.lastValidBlockHeight,i.recentBlockhash=r.blockhash,!e)break;if(i.sign(...e),!i.signature)throw Error("!signature");let n=i.signature.toString("base64");if(this._blockhashInfo.simulatedSignatures.includes(n)||this._blockhashInfo.transactionSignatures.includes(n))t=!0;else{this._blockhashInfo.simulatedSignatures.push(n);break}}}let n=i._compile(),s=n.serialize(),o=i._serialize(s).toString("base64"),u={encoding:"base64",commitment:this.commitment};r&&(u.accounts={encoding:"base64",addresses:(Array.isArray(r)?r:n.nonProgramIds()).map(t=>t.toBase58())}),e&&(u.sigVerify=!0),e&&"object"==typeof e&&"innerInstructions"in e&&(u.innerInstructions=e.innerInstructions);let l=[o,u],c=x(await this._rpcRequest("simulateTransaction",l),ep);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs)&&Array.isArray(t)){let e="\n ",r=e+t.join(e);console.error(c.error.message,r)}throw new tP({action:"simulate",signature:"",transactionMessage:c.error.message,logs:t})}return c.result}async sendTransaction(t,e,r){if("version"in t){if(e&&Array.isArray(e))throw Error("Invalid arguments");let r=t.serialize();return await this.sendRawTransaction(r,e)}if(void 0===e||!Array.isArray(e))throw Error("Invalid arguments");if(t.nonceInfo)t.sign(...e);else{let r=this._disableBlockhashCaching;for(;;){let i=await this._blockhashWithExpiryBlockHeight(r);if(t.lastValidBlockHeight=i.lastValidBlockHeight,t.recentBlockhash=i.blockhash,t.sign(...e),!t.signature)throw Error("!signature");let n=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(n))r=!0;else{this._blockhashInfo.transactionSignatures.push(n);break}}}let i=t.serialize();return await this.sendRawTransaction(i,r)}async sendRawTransaction(t,e){let r=ti(t).toString("base64");return await this.sendEncodedTransaction(r,e)}async sendEncodedTransaction(t,e){let r={encoding:"base64"},i=e&&e.skipPreflight,n=!0===i?"processed":e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(r.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(r.minContextSlot=e.minContextSlot),i&&(r.skipPreflight=i),n&&(r.preflightCommitment=n);let s=[t,r],o=x(await this._rpcRequest("sendTransaction",s),rb);if("error"in o){let t;throw"data"in o.error&&(t=o.error.data.logs),new tP({action:i?"send":"simulate",signature:"",transactionMessage:o.error.message,logs:t})}return o.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3===t)?this._updateSubscriptions():(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([t,e])=>{this._setSubscription(t,{...e,state:"pending"})}))}_setSubscription(t,e){let r=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,r!==e.state){let r=this._subscriptionStateChangeCallbacksByHash[t];r&&r.forEach(t=>{try{t(e.state)}catch{}})}}_onSubscriptionStateChange(t,e){let r=this._subscriptionHashByClientSubscriptionId[t];if(null==r)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[r]||=new Set;return i.add(e),()=>{i.delete(e),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}},500));return}if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();let t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async t=>{let r=this._subscriptionsByHash[t];if(void 0!==r)switch(r.state){case"pending":case"unsubscribed":if(0===r.callbacks.size){delete this._subscriptionsByHash[t],"unsubscribed"===r.state&&delete this._subscriptionCallbacksByServerSubscriptionId[r.serverSubscriptionId],await this._updateSubscriptions();return}await (async()=>{let{args:i,method:n}=r;try{this._setSubscription(t,{...r,state:"subscribing"});let e=await this._rpcWebSocket.call(n,i);this._setSubscription(t,{...r,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=r.callbacks,await this._updateSubscriptions()}catch(s){if(console.error(`Received ${s instanceof Error?"":"JSON-RPC "}error calling \`${n}\``,{args:i,error:s}),!e())return;this._setSubscription(t,{...r,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===r.callbacks.size&&await (async()=>{let{serverSubscriptionId:i,unsubscribeMethod:n}=r;if(this._subscriptionsAutoDisposedByRpc.has(i))this._subscriptionsAutoDisposedByRpc.delete(i);else{this._setSubscription(t,{...r,state:"unsubscribing"}),this._setSubscription(t,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(n,[i])}catch(i){if(i instanceof Error&&console.error(`${n} error:`,i.message),!e())return;this._setSubscription(t,{...r,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(t,{...r,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(t,e){let r=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==r&&r.forEach(t=>{try{t(...e)}catch(t){console.error(t)}})}_wsOnAccountNotification(t){let{result:e,subscription:r}=x(t,ez);this._handleServerNotification(r,[e.value,e.context])}_makeSubscription(t,e){let r=this._nextClientSubscriptionId++,i=tH([t.method,e]),n=this._subscriptionsByHash[i];return void 0===n?this._subscriptionsByHash[i]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:n.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let e=this._subscriptionsByHash[i];tm(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${r}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(t,e,r){let{commitment:i,config:n}=t6(r),s=this._buildArgs([t.toBase58()],i||this._commitment||"finalized","base64",n);return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},s)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){let{result:e,subscription:r}=x(t,ej);this._handleServerNotification(r,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,r,i){let{commitment:n,config:s}=t6(r),o=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",s||(i?{filters:t3(i)}:void 0));return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},o)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,r){let i=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],r||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){let{result:e,subscription:r}=x(t,rk);this._handleServerNotification(r,[e.value,e.context])}_wsOnSlotNotification(t){let{result:e,subscription:r}=x(t,eq);this._handleServerNotification(r,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){let{result:e,subscription:r}=x(t,e$);this._handleServerNotification(r,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){let r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,r,i){let n=e||this._commitment;if(n||r||i){let e={};r&&(e.encoding=r),n&&(e.commitment=n),i&&(e=Object.assign(e,i)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,r,i){let n=e||this._commitment;if(n&&!["confirmed","finalized"].includes(n))throw Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,r,i)}_wsOnSignatureNotification(t){let{result:e,subscription:r}=x(t,eF);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,r){let i=this._buildArgs([t],r||this._commitment||"finalized"),n=this._makeSubscription({callback:(t,r)=>{if("status"===t.type){e(t.result,r);try{this.removeSignatureListener(n)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return n}onSignatureWithOptions(t,e,r){let{commitment:i,...n}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},s=this._buildArgs([t],i,void 0,n),o=this._makeSubscription({callback:(t,r)=>{e(t,r);try{this.removeSignatureListener(o)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return o}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){let{result:e,subscription:r}=x(t,eH);this._handleServerNotification(r,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class rM{constructor(t){this._keypair=void 0,this._keypair=t??Q()}static generate(){return new rM(Q())}static fromSecretKey(t,e){if(64!==t.byteLength)throw Error("bad secret key size");let r=t.slice(32,64);if(!e||!e.skipValidation){let e=X(t.slice(0,32));for(let t=0;t<32;t++)if(r[t]!==e[t])throw Error("provided secretKey is invalid")}return new rM({publicKey:r,secretKey:t})}static fromSeed(t){let e=X(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),new rM({publicKey:e,secretKey:r})}get publicKey(){return new ta(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:g.struct([g.u32("instruction"),tq("recentSlot"),g.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:g.struct([g.u32("instruction")])},ExtendLookupTable:{index:2,layout:g.struct([g.u32("instruction"),tq(),g.seq(tf(),g.offset(g.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:g.struct([g.u32("instruction")])},CloseLookupTable:{index:4,layout:g.struct([g.u32("instruction")])}}),new ta("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:g.struct([g.u8("instruction"),g.u32("units"),g.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:g.struct([g.u8("instruction"),g.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:g.struct([g.u8("instruction"),g.u32("units")])},SetComputeUnitPrice:{index:3,layout:g.struct([g.u8("instruction"),tq("microLamports")])}}),new ta("ComputeBudget111111111111111111111111111111");let rA=g.struct([g.u8("numSignatures"),g.u8("padding"),g.u16("signatureOffset"),g.u16("signatureInstructionIndex"),g.u16("publicKeyOffset"),g.u16("publicKeyInstructionIndex"),g.u16("messageDataOffset"),g.u16("messageDataSize"),g.u16("messageInstructionIndex")]);class rI{constructor(){}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,instructionIndex:n}=t;tm(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),tm(64===i.length,`Signature must be 64 bytes but received ${i.length} bytes`);let s=rA.span,o=s+e.length,u=o+i.length,l=a.Buffer.alloc(u+r.length),c=null==n?65535:n;return rA.encode({numSignatures:1,padding:0,signatureOffset:o,signatureInstructionIndex:c,publicKeyOffset:s,publicKeyInstructionIndex:c,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:c},l),l.fill(e,s),l.fill(i,o),l.fill(r,u),new tI({keys:[],programId:rI.programId,data:l})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;tm(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{let t=rM.fromSecretKey(e),n=t.publicKey.toBytes(),s=te(r,t.secretKey);return this.createInstructionWithPublicKey({publicKey:n,message:r,signature:s,instructionIndex:i})}catch(t){throw Error(`Error creating instruction; ${t}`)}}}rI.programId=new ta("Ed25519SigVerify111111111111111111111111111"),G.bI.utils.isValidPrivateKey;let rx=G.bI.getPublicKey,r_=g.struct([g.u8("numSignatures"),g.u16("signatureOffset"),g.u8("signatureInstructionIndex"),g.u16("ethAddressOffset"),g.u8("ethAddressInstructionIndex"),g.u16("messageDataOffset"),g.u16("messageDataSize"),g.u8("messageInstructionIndex"),g.blob(20,"ethAddress"),g.blob(64,"signature"),g.u8("recoveryId")]);class rB{constructor(){}static publicKeyToEthAddress(t){tm(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return a.Buffer.from((0,Z.lY)(ti(t))).slice(-20)}catch(t){throw Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,recoveryId:n,instructionIndex:s}=t;return rB.createInstructionWithEthAddress({ethAddress:rB.publicKeyToEthAddress(e),message:r,signature:i,recoveryId:n,instructionIndex:s})}static createInstructionWithEthAddress(t){let e,{ethAddress:r,message:i,signature:n,recoveryId:s,instructionIndex:o=0}=t;tm(20===(e="string"==typeof r?r.startsWith("0x")?a.Buffer.from(r.substr(2),"hex"):a.Buffer.from(r,"hex"):r).length,`Address must be 20 bytes but received ${e.length} bytes`);let u=12+e.length,l=u+n.length+1,c=a.Buffer.alloc(r_.span+i.length);return r_.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:o,signature:ti(n),ethAddress:ti(e),recoveryId:s},c),c.fill(ti(i),r_.span),new tI({keys:[],programId:rB.programId,data:c})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;tm(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{var n;let t,s=ti(e),o=rx(s,!1).slice(1),[u,l]=(n=a.Buffer.from((0,Z.lY)(ti(r))),[(t=G.bI.sign(n,s)).toCompactRawBytes(),t.recovery]);return this.createInstructionWithPublicKey({publicKey:o,message:r,signature:u,recoveryId:l,instructionIndex:i})}catch(t){throw Error(`Error creating instruction; ${t}`)}}}rB.programId=new ta("KeccakSecp256k11111111111111111111111111111");let rT=new ta("StakeConfig11111111111111111111111111111111");class rC{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}}rC.default=new rC(0,0,ta.default);let rR=Object.freeze({Initialize:{index:0,layout:g.struct([g.u32("instruction"),((t="authorized")=>g.struct([tf("staker"),tf("withdrawer")],t))(),((t="lockup")=>g.struct([g.ns64("unixTimestamp"),g.ns64("epoch"),tf("custodian")],t))()])},Authorize:{index:1,layout:g.struct([g.u32("instruction"),tf("newAuthorized"),g.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:g.struct([g.u32("instruction")])},Split:{index:3,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},Withdraw:{index:4,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},Deactivate:{index:5,layout:g.struct([g.u32("instruction")])},Merge:{index:7,layout:g.struct([g.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:g.struct([g.u32("instruction"),tf("newAuthorized"),g.u32("stakeAuthorizationType"),td("authoritySeed"),tf("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class rP{constructor(){}static initialize(t){let{stakePubkey:e,authorized:r,lockup:i}=t,n=i||rC.default,s=tW(rR.Initialize,{authorized:{staker:ti(r.staker.toBuffer()),withdrawer:ti(r.withdrawer.toBuffer())},lockup:{unixTimestamp:n.unixTimestamp,epoch:n.epoch,custodian:ti(n.custodian.toBuffer())}});return new tI({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tC,isSigner:!1,isWritable:!1}],programId:this.programId,data:s})}static createAccountWithSeed(t){let e=new tx;e.add(t$.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static createAccount(t){let e=new tx;e.add(t$.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:n}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:n}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:r,votePubkey:i}=t,n=tW(rR.Delegate);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:tR,isSigner:!1,isWritable:!1},{pubkey:rT,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static authorize(t){let{stakePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,stakeAuthorizationType:n,custodianPubkey:s}=t,o=tW(rR.Authorize,{newAuthorized:ti(i.toBuffer()),stakeAuthorizationType:n.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new tx().add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:r,authoritySeed:i,authorityOwner:n,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=t,u=tW(rR.AuthorizeWithSeed,{newAuthorized:ti(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:i,authorityOwner:ti(n.toBuffer())}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:tB,isSigner:!1,isWritable:!1}];return a&&l.push({pubkey:a,isSigner:!0,isWritable:!1}),new tx().add({keys:l,programId:this.programId,data:u})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:r,splitStakePubkey:i,lamports:n}=t,s=tW(rR.Split,{lamports:n});return new tI({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(t,e){let r=new tx;return r.add(t$.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),r.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,basePubkey:s,seed:o,lamports:a}=t,u=new tx;return u.add(t$.allocate({accountPubkey:n,basePubkey:s,seed:o,space:this.space,programId:this.programId})),e&&e>0&&u.add(t$.transfer({fromPubkey:t.authorizedPubkey,toPubkey:n,lamports:e})),u.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:i,splitStakePubkey:n,lamports:a}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:r,authorizedPubkey:i}=t,n=tW(rR.Merge);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:tR,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:r,toPubkey:i,lamports:n,custodianPubkey:s}=t,o=tW(rR.Withdraw,{lamports:n}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:tR,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),new tx().add({keys:a,programId:this.programId,data:o})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:r}=t,i=tW(rR.Deactivate);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}}rP.programId=new ta("Stake11111111111111111111111111111111111111"),rP.space=200;let rL=Object.freeze({InitializeAccount:{index:0,layout:g.struct([g.u32("instruction"),((t="voteInit")=>g.struct([tf("nodePubkey"),tf("authorizedVoter"),tf("authorizedWithdrawer"),g.u8("commission")],t))()])},Authorize:{index:1,layout:g.struct([g.u32("instruction"),tf("newAuthorized"),g.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:g.struct([g.u32("instruction"),g.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:g.struct([g.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:g.struct([g.u32("instruction"),((t="voteAuthorizeWithSeedArgs")=>g.struct([g.u32("voteAuthorizationType"),tf("currentAuthorityDerivedKeyOwnerPubkey"),td("currentAuthorityDerivedKeySeed"),tf("newAuthorized")],t))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class rU{constructor(){}static initializeAccount(t){let{votePubkey:e,nodePubkey:r,voteInit:i}=t,n=tW(rL.InitializeAccount,{voteInit:{nodePubkey:ti(i.nodePubkey.toBuffer()),authorizedVoter:ti(i.authorizedVoter.toBuffer()),authorizedWithdrawer:ti(i.authorizedWithdrawer.toBuffer()),commission:i.commission}});return new tI({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tC,isSigner:!1,isWritable:!1},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static createAccount(t){let e=new tx;return e.add(t$.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,voteAuthorizationType:n}=t,s=tW(rL.Authorize,{newAuthorized:ti(i.toBuffer()),voteAuthorizationType:n.index});return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:n,voteAuthorizationType:s,votePubkey:o}=t,a=tW(rL.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:ti(r.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:ti(n.toBuffer()),voteAuthorizationType:s.index}});return new tx().add({keys:[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:tB,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,lamports:i,toPubkey:n}=t,s=tW(rL.Withdraw,{lamports:i});return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static safeWithdraw(t,e,r){if(t.lamports>e-r)throw Error("Withdraw will leave vote account with insufficient funds.");return rU.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,nodePubkey:i}=t,n=tW(rL.UpdateValidatorIdentity);return new tx().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}}rU.programId=new ta("Vote111111111111111111111111111111111111111"),rU.space=3762,new ta("Va1idator1nfo111111111111111111111111111111"),j({name:z(),website:O(z()),details:O(z()),iconUrl:O(z()),keybaseUsername:O(z())}),new ta("Vote111111111111111111111111111111111111111"),g.struct([tf("nodePubkey"),tf("authorizedWithdrawer"),g.u8("commission"),g.nu64(),g.seq(g.struct([g.nu64("slot"),g.u32("confirmationCount")]),g.offset(g.u32(),-8),"votes"),g.u8("rootSlotValid"),g.nu64("rootSlot"),g.nu64(),g.seq(g.struct([g.nu64("epoch"),tf("authorizedVoter")]),g.offset(g.u32(),-8),"authorizedVoters"),g.struct([g.seq(g.struct([tf("authorizedPubkey"),g.nu64("epochOfLastAuthorizedSwitch"),g.nu64("targetEpoch")]),32,"buf"),g.nu64("idx"),g.u8("isEmpty")],"priorVoters"),g.nu64(),g.seq(g.struct([g.nu64("epoch"),g.nu64("credits"),g.nu64("prevCredits")]),g.offset(g.u32(),-8),"epochCredits"),g.struct([g.nu64("slot"),g.nu64("timestamp")],"lastTimestamp")])},9948:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(("le"===e||"be"===e)&&(r=e,e=10),this._init(t||0,e||10,r||"be"))}"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{h="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3112).Buffer}catch(t){}function o(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function u(t,e,r,n){for(var s=0,o=0,a=Math.min(t.length,r),u=e;u<a;u++){var l=t.charCodeAt(u)-48;s*=n,o=l>=49?l-49+10:l>=17?l-17+10:l,i(l>=0&&o<n,"Invalid character"),s+=o}return s}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return 0>t.cmp(e)?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<0x4000000?(this.words=[0x3ffffff&t],this.length=1):t<0x10000000000000?(this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff],this.length=2):(i(t<0x20000000000000),this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=t.length-1,n=0;o>=0;o-=3)s=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(o=0,n=0;o<t.length;o+=3)s=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);return this._strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var i,n=0;n<this.length;n++)this.words[n]=0;var s=0,o=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=0x3ffffff;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,l=0,c=r;c<a;c+=i)l=u(t,c,c+i,e),this.imuln(n),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==o){var h=1;for(l=u(t,c,t.length,e),c=0;c<o;c++)h*=e;this.imuln(h),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this._strip()},s.prototype.copy=function(t){t.words=Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype._move=function(t){l(t,this)},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){s.prototype.inspect=c}else s.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h,f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];function g(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=0x3ffffff&o,u=o/0x4000000|0;r.words[0]=a;for(var l=1;l<i;l++){for(var c=u>>>26,h=0x3ffffff&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;c+=(o=(n=0|t.words[p])*(s=0|e.words[d])+h)/0x4000000|0,h=0x3ffffff&o}r.words[l]=0|h,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}s.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){for(var r="",n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=((a<<n|s)&0xffffff).toString(16);s=a>>>24-n&0xffffff,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],c=p[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var g=h.modrn(c).toString(t);r=(h=h.idivn(c)).isZero()?g+r:f[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=0x4000000*this.words[1]:3===this.length&&1===this.words[2]?t+=0x10000000000000+0x4000000*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},h&&(s.prototype.toBuffer=function(t,e){return this.toArrayLike(h,t,e)}),s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=t.allocUnsafe?t.allocUnsafe(s):new t(s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===s?(r<t.length&&(t[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},s.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return(8191&e)==0&&(r+=13,e>>>=13),(127&e)==0&&(r+=7,e>>>=7),(15&e)==0&&(r+=4,e>>>=4),(3&e)==0&&(r+=2,e>>>=2),(1&e)==0&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},s.prototype.ior=function(t){return i((this.negative|t.negative)==0),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},s.prototype.iand=function(t){return i((this.negative|t.negative)==0),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},s.prototype.ixor=function(t){return i((this.negative|t.negative)==0),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=0x3ffffff&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&0x3ffffff>>26-r),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),e?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),this._strip()},s.prototype.iadd=function(t){if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e,r,i,n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=0x3ffffff&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=0x3ffffff&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(e=this,r=t):(e=t,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|e.words[o])-(0|r.words[o])+s)>>26,this.words[o]=0x3ffffff&i;for(;0!==s&&o<e.length;o++)s=(i=(0|e.words[o])+s)>>26,this.words[o]=0x3ffffff&i;if(0===s&&o<e.length&&e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this.length=Math.max(this.length,o),e!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var i,n,s,o=t.words,a=e.words,u=r.words,l=0,c=0|o[0],h=8191&c,f=c>>>13,d=0|o[1],p=8191&d,g=d>>>13,m=0|o[2],y=8191&m,w=m>>>13,b=0|o[3],v=8191&b,k=b>>>13,S=0|o[4],E=8191&S,M=S>>>13,A=0|o[5],I=8191&A,x=A>>>13,_=0|o[6],B=8191&_,T=_>>>13,C=0|o[7],R=8191&C,P=C>>>13,L=0|o[8],U=8191&L,O=L>>>13,W=0|o[9],z=8191&W,N=W>>>13,j=0|a[0],K=8191&j,q=j>>>13,D=0|a[1],$=8191&D,F=D>>>13,H=0|a[2],V=8191&H,J=H>>>13,Y=0|a[3],Z=8191&Y,G=Y>>>13,Q=0|a[4],X=8191&Q,tt=Q>>>13,te=0|a[5],tr=8191&te,ti=te>>>13,tn=0|a[6],ts=8191&tn,to=tn>>>13,ta=0|a[7],tu=8191&ta,tl=ta>>>13,tc=0|a[8],th=8191&tc,tf=tc>>>13,td=0|a[9],tp=8191&td,tg=td>>>13;r.negative=t.negative^e.negative,r.length=19,i=Math.imul(h,K);var tm=(l+i|0)+((8191&(n=(n=Math.imul(h,q))+Math.imul(f,K)|0))<<13)|0;l=((s=Math.imul(f,q))+(n>>>13)|0)+(tm>>>26)|0,tm&=0x3ffffff,i=Math.imul(p,K),n=(n=Math.imul(p,q))+Math.imul(g,K)|0,s=Math.imul(g,q),i=i+Math.imul(h,$)|0;var ty=(l+i|0)+((8191&(n=(n=n+Math.imul(h,F)|0)+Math.imul(f,$)|0))<<13)|0;l=((s=s+Math.imul(f,F)|0)+(n>>>13)|0)+(ty>>>26)|0,ty&=0x3ffffff,i=Math.imul(y,K),n=(n=Math.imul(y,q))+Math.imul(w,K)|0,s=Math.imul(w,q),i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(g,$)|0,s=s+Math.imul(g,F)|0,i=i+Math.imul(h,V)|0;var tw=(l+i|0)+((8191&(n=(n=n+Math.imul(h,J)|0)+Math.imul(f,V)|0))<<13)|0;l=((s=s+Math.imul(f,J)|0)+(n>>>13)|0)+(tw>>>26)|0,tw&=0x3ffffff,i=Math.imul(v,K),n=(n=Math.imul(v,q))+Math.imul(k,K)|0,s=Math.imul(k,q),i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,F)|0)+Math.imul(w,$)|0,s=s+Math.imul(w,F)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,J)|0,i=i+Math.imul(h,Z)|0;var tb=(l+i|0)+((8191&(n=(n=n+Math.imul(h,G)|0)+Math.imul(f,Z)|0))<<13)|0;l=((s=s+Math.imul(f,G)|0)+(n>>>13)|0)+(tb>>>26)|0,tb&=0x3ffffff,i=Math.imul(E,K),n=(n=Math.imul(E,q))+Math.imul(M,K)|0,s=Math.imul(M,q),i=i+Math.imul(v,$)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,F)|0,i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,V)|0,s=s+Math.imul(w,J)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,G)|0,i=i+Math.imul(h,X)|0;var tv=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tt)|0)+Math.imul(f,X)|0))<<13)|0;l=((s=s+Math.imul(f,tt)|0)+(n>>>13)|0)+(tv>>>26)|0,tv&=0x3ffffff,i=Math.imul(I,K),n=(n=Math.imul(I,q))+Math.imul(x,K)|0,s=Math.imul(x,q),i=i+Math.imul(E,$)|0,n=(n=n+Math.imul(E,F)|0)+Math.imul(M,$)|0,s=s+Math.imul(M,F)|0,i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,J)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(w,Z)|0,s=s+Math.imul(w,G)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,X)|0,s=s+Math.imul(g,tt)|0,i=i+Math.imul(h,tr)|0;var tk=(l+i|0)+((8191&(n=(n=n+Math.imul(h,ti)|0)+Math.imul(f,tr)|0))<<13)|0;l=((s=s+Math.imul(f,ti)|0)+(n>>>13)|0)+(tk>>>26)|0,tk&=0x3ffffff,i=Math.imul(B,K),n=(n=Math.imul(B,q))+Math.imul(T,K)|0,s=Math.imul(T,q),i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,F)|0)+Math.imul(x,$)|0,s=s+Math.imul(x,F)|0,i=i+Math.imul(E,V)|0,n=(n=n+Math.imul(E,J)|0)+Math.imul(M,V)|0,s=s+Math.imul(M,J)|0,i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,G)|0)+Math.imul(k,Z)|0,s=s+Math.imul(k,G)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,s=s+Math.imul(w,tt)|0,i=i+Math.imul(p,tr)|0,n=(n=n+Math.imul(p,ti)|0)+Math.imul(g,tr)|0,s=s+Math.imul(g,ti)|0,i=i+Math.imul(h,ts)|0;var tS=(l+i|0)+((8191&(n=(n=n+Math.imul(h,to)|0)+Math.imul(f,ts)|0))<<13)|0;l=((s=s+Math.imul(f,to)|0)+(n>>>13)|0)+(tS>>>26)|0,tS&=0x3ffffff,i=Math.imul(R,K),n=(n=Math.imul(R,q))+Math.imul(P,K)|0,s=Math.imul(P,q),i=i+Math.imul(B,$)|0,n=(n=n+Math.imul(B,F)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,F)|0,i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(x,V)|0,s=s+Math.imul(x,J)|0,i=i+Math.imul(E,Z)|0,n=(n=n+Math.imul(E,G)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,G)|0,i=i+Math.imul(v,X)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(k,X)|0,s=s+Math.imul(k,tt)|0,i=i+Math.imul(y,tr)|0,n=(n=n+Math.imul(y,ti)|0)+Math.imul(w,tr)|0,s=s+Math.imul(w,ti)|0,i=i+Math.imul(p,ts)|0,n=(n=n+Math.imul(p,to)|0)+Math.imul(g,ts)|0,s=s+Math.imul(g,to)|0,i=i+Math.imul(h,tu)|0;var tE=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tl)|0)+Math.imul(f,tu)|0))<<13)|0;l=((s=s+Math.imul(f,tl)|0)+(n>>>13)|0)+(tE>>>26)|0,tE&=0x3ffffff,i=Math.imul(U,K),n=(n=Math.imul(U,q))+Math.imul(O,K)|0,s=Math.imul(O,q),i=i+Math.imul(R,$)|0,n=(n=n+Math.imul(R,F)|0)+Math.imul(P,$)|0,s=s+Math.imul(P,F)|0,i=i+Math.imul(B,V)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,J)|0,i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,G)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,G)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(M,X)|0,s=s+Math.imul(M,tt)|0,i=i+Math.imul(v,tr)|0,n=(n=n+Math.imul(v,ti)|0)+Math.imul(k,tr)|0,s=s+Math.imul(k,ti)|0,i=i+Math.imul(y,ts)|0,n=(n=n+Math.imul(y,to)|0)+Math.imul(w,ts)|0,s=s+Math.imul(w,to)|0,i=i+Math.imul(p,tu)|0,n=(n=n+Math.imul(p,tl)|0)+Math.imul(g,tu)|0,s=s+Math.imul(g,tl)|0,i=i+Math.imul(h,th)|0;var tM=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tf)|0)+Math.imul(f,th)|0))<<13)|0;l=((s=s+Math.imul(f,tf)|0)+(n>>>13)|0)+(tM>>>26)|0,tM&=0x3ffffff,i=Math.imul(z,K),n=(n=Math.imul(z,q))+Math.imul(N,K)|0,s=Math.imul(N,q),i=i+Math.imul(U,$)|0,n=(n=n+Math.imul(U,F)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,F)|0,i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,J)|0,i=i+Math.imul(B,Z)|0,n=(n=n+Math.imul(B,G)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,G)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(x,X)|0,s=s+Math.imul(x,tt)|0,i=i+Math.imul(E,tr)|0,n=(n=n+Math.imul(E,ti)|0)+Math.imul(M,tr)|0,s=s+Math.imul(M,ti)|0,i=i+Math.imul(v,ts)|0,n=(n=n+Math.imul(v,to)|0)+Math.imul(k,ts)|0,s=s+Math.imul(k,to)|0,i=i+Math.imul(y,tu)|0,n=(n=n+Math.imul(y,tl)|0)+Math.imul(w,tu)|0,s=s+Math.imul(w,tl)|0,i=i+Math.imul(p,th)|0,n=(n=n+Math.imul(p,tf)|0)+Math.imul(g,th)|0,s=s+Math.imul(g,tf)|0,i=i+Math.imul(h,tp)|0;var tA=(l+i|0)+((8191&(n=(n=n+Math.imul(h,tg)|0)+Math.imul(f,tp)|0))<<13)|0;l=((s=s+Math.imul(f,tg)|0)+(n>>>13)|0)+(tA>>>26)|0,tA&=0x3ffffff,i=Math.imul(z,$),n=(n=Math.imul(z,F))+Math.imul(N,$)|0,s=Math.imul(N,F),i=i+Math.imul(U,V)|0,n=(n=n+Math.imul(U,J)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,G)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(T,X)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(I,tr)|0,n=(n=n+Math.imul(I,ti)|0)+Math.imul(x,tr)|0,s=s+Math.imul(x,ti)|0,i=i+Math.imul(E,ts)|0,n=(n=n+Math.imul(E,to)|0)+Math.imul(M,ts)|0,s=s+Math.imul(M,to)|0,i=i+Math.imul(v,tu)|0,n=(n=n+Math.imul(v,tl)|0)+Math.imul(k,tu)|0,s=s+Math.imul(k,tl)|0,i=i+Math.imul(y,th)|0,n=(n=n+Math.imul(y,tf)|0)+Math.imul(w,th)|0,s=s+Math.imul(w,tf)|0,i=i+Math.imul(p,tp)|0;var tI=(l+i|0)+((8191&(n=(n=n+Math.imul(p,tg)|0)+Math.imul(g,tp)|0))<<13)|0;l=((s=s+Math.imul(g,tg)|0)+(n>>>13)|0)+(tI>>>26)|0,tI&=0x3ffffff,i=Math.imul(z,V),n=(n=Math.imul(z,J))+Math.imul(N,V)|0,s=Math.imul(N,J),i=i+Math.imul(U,Z)|0,n=(n=n+Math.imul(U,G)|0)+Math.imul(O,Z)|0,s=s+Math.imul(O,G)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(B,tr)|0,n=(n=n+Math.imul(B,ti)|0)+Math.imul(T,tr)|0,s=s+Math.imul(T,ti)|0,i=i+Math.imul(I,ts)|0,n=(n=n+Math.imul(I,to)|0)+Math.imul(x,ts)|0,s=s+Math.imul(x,to)|0,i=i+Math.imul(E,tu)|0,n=(n=n+Math.imul(E,tl)|0)+Math.imul(M,tu)|0,s=s+Math.imul(M,tl)|0,i=i+Math.imul(v,th)|0,n=(n=n+Math.imul(v,tf)|0)+Math.imul(k,th)|0,s=s+Math.imul(k,tf)|0,i=i+Math.imul(y,tp)|0;var tx=(l+i|0)+((8191&(n=(n=n+Math.imul(y,tg)|0)+Math.imul(w,tp)|0))<<13)|0;l=((s=s+Math.imul(w,tg)|0)+(n>>>13)|0)+(tx>>>26)|0,tx&=0x3ffffff,i=Math.imul(z,Z),n=(n=Math.imul(z,G))+Math.imul(N,Z)|0,s=Math.imul(N,G),i=i+Math.imul(U,X)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(O,X)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(R,tr)|0,n=(n=n+Math.imul(R,ti)|0)+Math.imul(P,tr)|0,s=s+Math.imul(P,ti)|0,i=i+Math.imul(B,ts)|0,n=(n=n+Math.imul(B,to)|0)+Math.imul(T,ts)|0,s=s+Math.imul(T,to)|0,i=i+Math.imul(I,tu)|0,n=(n=n+Math.imul(I,tl)|0)+Math.imul(x,tu)|0,s=s+Math.imul(x,tl)|0,i=i+Math.imul(E,th)|0,n=(n=n+Math.imul(E,tf)|0)+Math.imul(M,th)|0,s=s+Math.imul(M,tf)|0,i=i+Math.imul(v,tp)|0;var t_=(l+i|0)+((8191&(n=(n=n+Math.imul(v,tg)|0)+Math.imul(k,tp)|0))<<13)|0;l=((s=s+Math.imul(k,tg)|0)+(n>>>13)|0)+(t_>>>26)|0,t_&=0x3ffffff,i=Math.imul(z,X),n=(n=Math.imul(z,tt))+Math.imul(N,X)|0,s=Math.imul(N,tt),i=i+Math.imul(U,tr)|0,n=(n=n+Math.imul(U,ti)|0)+Math.imul(O,tr)|0,s=s+Math.imul(O,ti)|0,i=i+Math.imul(R,ts)|0,n=(n=n+Math.imul(R,to)|0)+Math.imul(P,ts)|0,s=s+Math.imul(P,to)|0,i=i+Math.imul(B,tu)|0,n=(n=n+Math.imul(B,tl)|0)+Math.imul(T,tu)|0,s=s+Math.imul(T,tl)|0,i=i+Math.imul(I,th)|0,n=(n=n+Math.imul(I,tf)|0)+Math.imul(x,th)|0,s=s+Math.imul(x,tf)|0,i=i+Math.imul(E,tp)|0;var tB=(l+i|0)+((8191&(n=(n=n+Math.imul(E,tg)|0)+Math.imul(M,tp)|0))<<13)|0;l=((s=s+Math.imul(M,tg)|0)+(n>>>13)|0)+(tB>>>26)|0,tB&=0x3ffffff,i=Math.imul(z,tr),n=(n=Math.imul(z,ti))+Math.imul(N,tr)|0,s=Math.imul(N,ti),i=i+Math.imul(U,ts)|0,n=(n=n+Math.imul(U,to)|0)+Math.imul(O,ts)|0,s=s+Math.imul(O,to)|0,i=i+Math.imul(R,tu)|0,n=(n=n+Math.imul(R,tl)|0)+Math.imul(P,tu)|0,s=s+Math.imul(P,tl)|0,i=i+Math.imul(B,th)|0,n=(n=n+Math.imul(B,tf)|0)+Math.imul(T,th)|0,s=s+Math.imul(T,tf)|0,i=i+Math.imul(I,tp)|0;var tT=(l+i|0)+((8191&(n=(n=n+Math.imul(I,tg)|0)+Math.imul(x,tp)|0))<<13)|0;l=((s=s+Math.imul(x,tg)|0)+(n>>>13)|0)+(tT>>>26)|0,tT&=0x3ffffff,i=Math.imul(z,ts),n=(n=Math.imul(z,to))+Math.imul(N,ts)|0,s=Math.imul(N,to),i=i+Math.imul(U,tu)|0,n=(n=n+Math.imul(U,tl)|0)+Math.imul(O,tu)|0,s=s+Math.imul(O,tl)|0,i=i+Math.imul(R,th)|0,n=(n=n+Math.imul(R,tf)|0)+Math.imul(P,th)|0,s=s+Math.imul(P,tf)|0,i=i+Math.imul(B,tp)|0;var tC=(l+i|0)+((8191&(n=(n=n+Math.imul(B,tg)|0)+Math.imul(T,tp)|0))<<13)|0;l=((s=s+Math.imul(T,tg)|0)+(n>>>13)|0)+(tC>>>26)|0,tC&=0x3ffffff,i=Math.imul(z,tu),n=(n=Math.imul(z,tl))+Math.imul(N,tu)|0,s=Math.imul(N,tl),i=i+Math.imul(U,th)|0,n=(n=n+Math.imul(U,tf)|0)+Math.imul(O,th)|0,s=s+Math.imul(O,tf)|0,i=i+Math.imul(R,tp)|0;var tR=(l+i|0)+((8191&(n=(n=n+Math.imul(R,tg)|0)+Math.imul(P,tp)|0))<<13)|0;l=((s=s+Math.imul(P,tg)|0)+(n>>>13)|0)+(tR>>>26)|0,tR&=0x3ffffff,i=Math.imul(z,th),n=(n=Math.imul(z,tf))+Math.imul(N,th)|0,s=Math.imul(N,tf),i=i+Math.imul(U,tp)|0;var tP=(l+i|0)+((8191&(n=(n=n+Math.imul(U,tg)|0)+Math.imul(O,tp)|0))<<13)|0;l=((s=s+Math.imul(O,tg)|0)+(n>>>13)|0)+(tP>>>26)|0,tP&=0x3ffffff,i=Math.imul(z,tp);var tL=(l+i|0)+((8191&(n=(n=Math.imul(z,tg))+Math.imul(N,tp)|0))<<13)|0;return l=((s=Math.imul(N,tg))+(n>>>13)|0)+(tL>>>26)|0,tL&=0x3ffffff,u[0]=tm,u[1]=ty,u[2]=tw,u[3]=tb,u[4]=tv,u[5]=tk,u[6]=tS,u[7]=tE,u[8]=tM,u[9]=tA,u[10]=tI,u[11]=tx,u[12]=t_,u[13]=tB,u[14]=tT,u[15]=tC,u[16]=tR,u[17]=tP,u[18]=tL,0!==l&&(u[19]=l,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=0x3ffffff&i,u=Math.min(s,e.length-1),l=Math.max(0,s-t.length+1);l<=u;l++){var c=s-l,h=(0|t.words[c])*(0|e.words[l]),f=0x3ffffff&h;o=o+(h/0x4000000|0)|0,a=0x3ffffff&(f=f+a|0),n+=(o=o+(f>>>26)|0)>>>26,o&=0x3ffffff}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function w(t,e){this.x=t,this.y=e}Math.imul||(m=g),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return 10===this.length&&10===t.length?r=m(this,t,e):i<63?r=g(this,t,e):r=y(this,t,e),r},w.prototype.makeRBT=function(t){for(var e=Array(t),r=s.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},w.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},w.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},w.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),c=0;c<n;c+=a)for(var h=u,f=l,d=0;d<o;d++){var p=r[c+d],g=i[c+d],m=r[c+d+o],y=i[c+d+o],w=h*m-f*y;y=h*y+f*m,m=w,r[c+d]=p+m,i[c+d]=g+y,r[c+d+o]=p-m,i[c+d+o]=g-y,d!==a&&(w=u*h-l*f,f=u*f+l*h,h=w)}},w.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},w.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},w.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=0x3ffffff&n,r=n<0x4000000?0:n/0x4000000|0}return t},w.prototype.convert13b=function(t,e,r,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)r[o]=0;i(0===s),i((-8192&s)==0)},w.prototype.stub=function(t){for(var e=Array(t),r=0;r<t;r++)e[r]=0;return e},w.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),u=Array(i),l=Array(i),c=Array(i),h=Array(i),f=r.words;f.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,l,i),this.transform(o,s,a,u,i,n),this.transform(l,s,c,h,i,n);for(var d=0;d<i;d++){var p=a[d]*c[d]-u[d]*h[d];u[d]=a[d]*h[d]+u[d]*c[d],a[d]=p}return this.conjugate(a,u,i),this.transform(a,u,f,s,i,n),this.conjugate(f,s,i),this.normalize13b(f,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=Array(this.length+t.length),y(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){var e=t<0;e&&(t=-t),i("number"==typeof t),i(t<0x4000000);for(var r=0,n=0;n<this.length;n++){var s=(0|this.words[n])*t,o=(0x3ffffff&s)+(0x3ffffff&r);r>>=26,r+=(s/0x4000000|0)+(o>>>26),this.words[n]=0x3ffffff&o}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,s=0x3ffffff>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,u=(0|this.words[e])-a<<r;this.words[e]=u|o,o=a>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){i("number"==typeof t&&t>=0);var n=e?(e-e%26)/26:0,s=t%26,o=Math.min((t-s)/26,this.length),a=0x3ffffff^0x3ffffff>>>s<<s;if(n-=o,n=Math.max(0,n),r){for(var u=0;u<o;u++)r.words[u]=this.words[u];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-s|c>>>s,l=c&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return!(this.length<=r)&&!!(this.words[r]&1<<e)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==e&&r++,this.length=Math.min(r,this.length),0!==e&&(this.words[this.length-1]&=0x3ffffff^0x3ffffff>>>e<<e),this._strip())},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return(i("number"==typeof t),i(t<0x4000000),t<0)?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=0x4000000;e++)this.words[e]-=0x4000000,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<0x4000000),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=0x4000000,this.words[e+1]-=1;return this._strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,s,o=t.length+r;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+r])+a;var u=(0|t.words[n])*e;s-=0x3ffffff&u,a=(s>>26)-(u/0x4000000|0),this.words[n+r]=0x3ffffff&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=0x3ffffff&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=0x3ffffff&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,e){var r,i=this.length-t.length,n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),n.iushln(i),a=0|o.words[o.length-1]);var u=n.length-o.length;if("mod"!==e){(r=new s(null)).length=u+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,r&&(r.words[u]=1));for(var h=u-1;h>=0;h--){var f=(0|n.words[o.length+h])*0x4000000+(0|n.words[o.length+h-1]);for(f=Math.min(f/a|0,0x3ffffff),n._ishlnsubmul(o,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,h),n.isZero()||(n.negative^=1);r&&(r.words[h]=f)}return r&&r._strip(),n._strip(),"div"!==e&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(t,e,r){var n,o,a;return(i(!t.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):(this.negative&t.negative)!=0?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||0>this.cmp(t)?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=0x3ffffff);for(var r=0x4000000%t,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%t;return e?-n:n},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=0x3ffffff);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+0x4000000*r;this.words[n]=s/t|0,r=s%t}return this._strip(),e?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;(e.words[0]&d)==0&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(c),o.isub(h)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;(r.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(u)):(r.isub(e),a.isub(n),u.isub(o))}return{a:a,b:u,gcd:r.iushln(l)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e,r=this,n=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var o=new s(1),a=new s(0),u=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,c=1;(r.words[0]&c)==0&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var h=0,f=1;(n.words[0]&f)==0&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(a)):(n.isub(r),a.isub(o))}return 0>(e=0===r.cmpn(1)?o:a).cmpn(0)&&e.iadd(t),e},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=0x3ffffff,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=0x3ffffff,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return -1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return -1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return -1===this.cmpn(t)},s.prototype.lt=function(t){return -1===this.cmp(t)},s.prototype.lten=function(t){return 0>=this.cmpn(t)},s.prototype.lte=function(t){return 0>=this.cmp(t)},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new A(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function I(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new s(null);return t.words=Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(k,v),k.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9){t.words[0]=0,t.length=1;return}var n=t.words[9];for(i=10,e.words[e.length++]=4194303&n;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},k.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=0x3ffffff&e,e=64*i+(e/0x4000000|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(S,v),n(E,v),n(M,v),M.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=(0|t.words[r])*19+e,n=0x3ffffff&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){var e;if(b[t])return b[t];if("k256"===t)e=new k;else if("p224"===t)e=new S;else if("p192"===t)e=new E;else if("p25519"===t)e=new M;else throw Error("Unknown prime "+t);return b[t]=e,e},A.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){i((t.negative|e.negative)==0,"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,n),f=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();i(m<p);var y=this.pow(h,new s(1).iushln(p-m-1));f=f.redMul(y),h=y.redSqr(),d=d.redMul(h),p=m}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),i=e.length-1;i>=0;i--){for(var l=e.words[i],c=u-1;c>=0;c--){var h=l>>c&1;if(n!==r[0]&&(n=this.sqr(n)),0===h&&0===o){a=0;continue}o<<=1,o|=h,(4==++a||0===i&&0===c)&&(n=this.mul(n,r[o]),a=0,o=0)}u=26}return n},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new I(t)},n(I,A),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},8866:function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__decorate||function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeUnchecked=e.deserialize=e.serialize=e.BinaryReader=e.BinaryWriter=e.BorshError=e.baseDecode=e.baseEncode=void 0;let u=a(r(9948)),l=a(r(6846)),c=o(r(2614)),h=new("function"!=typeof TextDecoder?c.TextDecoder:TextDecoder)("utf-8",{fatal:!0});e.baseEncode=function(t){return"string"==typeof t&&(t=Buffer.from(t,"utf8")),l.default.encode(Buffer.from(t))},e.baseDecode=function(t){return Buffer.from(l.default.decode(t))};class f extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}e.BorshError=f;class d{constructor(){this.buf=Buffer.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(1024)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new u.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(1024)]),this.length+=t.length}writeString(t){this.maybeResize();let e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){for(let r of(this.maybeResize(),this.writeU32(t.length),t))this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}}function p(t,e,r){let i=r.value;r.value=function(...t){try{return i.apply(this,t)}catch(t){if(t instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t.code)>=0)throw new f("Reached the end of buffer when deserializing");throw t}}}e.BinaryWriter=d;class g{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new u.default(t,"le")}readU128(){let t=this.readBuffer(16);return new u.default(t,"le")}readU256(){let t=this.readBuffer(32);return new u.default(t,"le")}readU512(){let t=this.readBuffer(64);return new u.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new f(`Expected buffer length ${t} isn't within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return h.decode(e)}catch(t){throw new f(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),r=[];for(let i=0;i<e;++i)r.push(t());return r}}function m(t){return t.charAt(0).toUpperCase()+t.slice(1)}function y(t,e,r,i,n){try{if("string"==typeof i)n[`write${m(i)}`](r);else if(i instanceof Array)if("number"==typeof i[0]){if(r.length!==i[0])throw new f(`Expecting byte array of length ${i[0]}, but got ${r.length} bytes`);n.writeFixedArray(r)}else if(2===i.length&&"number"==typeof i[1]){if(r.length!==i[1])throw new f(`Expecting byte array of length ${i[1]}, but got ${r.length} bytes`);for(let e=0;e<i[1];e++)y(t,null,r[e],i[0],n)}else n.writeArray(r,r=>{y(t,e,r,i[0],n)});else if(void 0!==i.kind)switch(i.kind){case"option":null==r?n.writeU8(0):(n.writeU8(1),y(t,e,r,i.type,n));break;case"map":n.writeU32(r.size),r.forEach((r,s)=>{y(t,e,s,i.key,n),y(t,e,r,i.value,n)});break;default:throw new f(`FieldType ${i} unrecognized`)}else w(t,r,n)}catch(t){throw t instanceof f&&t.addToFieldPath(e),t}}function w(t,e,r){if("function"==typeof e.borshSerialize)return void e.borshSerialize(r);let i=t.get(e.constructor);if(!i)throw new f(`Class ${e.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{y(t,i,e[i],n,r)});else if("enum"===i.kind){let n=e[i.field];for(let s=0;s<i.values.length;++s){let[o,a]=i.values[s];if(o===n){r.writeU8(s),y(t,o,e[o],a,r);break}}}else throw new f(`Unexpected schema kind: ${i.kind} for ${e.constructor.name}`)}function b(t,e,r,i){try{if("string"==typeof r)return i[`read${m(r)}`]();if(r instanceof Array)if("number"==typeof r[0])return i.readFixedArray(r[0]);else{if("number"!=typeof r[1])return i.readArray(()=>b(t,e,r[0],i));let n=[];for(let e=0;e<r[1];e++)n.push(b(t,null,r[0],i));return n}if("option"===r.kind){if(i.readU8())return b(t,e,r.type,i);return}if("map"===r.kind){let n=new Map,s=i.readU32();for(let o=0;o<s;o++){let s=b(t,e,r.key,i),o=b(t,e,r.value,i);n.set(s,o)}return n}return v(t,r,i)}catch(t){throw t instanceof f&&t.addToFieldPath(e),t}}function v(t,e,r){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(r);let i=t.get(e);if(!i)throw new f(`Class ${e.name} is missing in schema`);if("struct"===i.kind){let i={};for(let[n,s]of t.get(e).fields)i[n]=b(t,n,s,r);return new e(i)}if("enum"===i.kind){let n=r.readU8();if(n>=i.values.length)throw new f(`Enum index: ${n} is out of range`);let[s,o]=i.values[n],a=b(t,s,o,r);return new e({[s]:a})}throw new f(`Unexpected schema kind: ${i.kind} for ${e.constructor.name}`)}s([p],g.prototype,"readU8",null),s([p],g.prototype,"readU16",null),s([p],g.prototype,"readU32",null),s([p],g.prototype,"readU64",null),s([p],g.prototype,"readU128",null),s([p],g.prototype,"readU256",null),s([p],g.prototype,"readU512",null),s([p],g.prototype,"readString",null),s([p],g.prototype,"readFixedArray",null),s([p],g.prototype,"readArray",null),e.BinaryReader=g,e.serialize=function(t,e,r=d){let i=new r;return w(t,e,i),i.toArray()},e.deserialize=function(t,e,r,i=g){let n=new i(r),s=v(t,e,n);if(n.offset<r.length)throw new f(`Unexpected ${r.length-n.offset} bytes after deserialized data`);return s},e.deserializeUnchecked=function(t,e,r,i=g){return v(t,e,new i(r))}},6846:function(t,e,r){t.exports=r(7107)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9774:function(t,e,r){t.exports=r(3863)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},6336:function(t,e,r){"use strict";var i=r(5186),n=r(7423),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t){var i=t,n=e;if(("string"!=typeof n||""===n)&&(n="utf8"),!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);var s=0|p(i,n),u=o(s),l=u.write(i,n);return l!==s&&(u=u.slice(0,l)),u}if(ArrayBuffer.isView(t)){var c=t;if(B(c,Uint8Array)){var g=new Uint8Array(c);return f(g.buffer,g.byteOffset,g.byteLength)}return h(c)}if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(B(t,SharedArrayBuffer)||t&&B(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');var m=t.valueOf&&t.valueOf();if(null!=m&&m!==t)return a.from(m,e,r);var y=function(t){if(a.isBuffer(t)){var e=0|d(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||function(t){return t!=t}(t.length)?o(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(y)return y;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),o(t<0?0:0|d(t))}function h(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function f(t,e,r){var i;if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),i}function d(t){if(t>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return I(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(n)return i?-1:I(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n,s,o,a=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=e;s<r;++s)n+=T[t[s]];return n}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}(this,e,r);case"latin1":case"binary":return function(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}(this,e,r);case"base64":return n=this,s=e,o=r,0===s&&o===n.length?i.fromByteArray(n):i.fromByteArray(n.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){for(var i=t.slice(e,r),n="",s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}(this,e,r);default:if(a)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),a=!0}}function m(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){var s;if(0===t.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(n)return -1;else r=t.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,i)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,i,n);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return w(t,[e],r,i,n)}throw TypeError("val must be string, number or Buffer")}function w(t,e,r,i,n){var s,o=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var c=-1;for(s=r;s<a;s++)if(l(t,s)===l(e,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===u)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){for(var h=!0,f=0;f<u;f++)if(l(t,s+f)!==l(e,f)){h=!1;break}if(h)return s}return -1}function b(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var s,o,a,u,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h<=r)switch(h){case 1:l<128&&(c=l);break;case 2:(192&(s=t[n+1]))==128&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],o=t[n+2],(192&s)==128&&(192&o)==128&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=h}var f=i,d=f.length;if(d<=4096)return String.fromCharCode.apply(String,f);for(var p="",g=0;g<d;)p+=String.fromCharCode.apply(String,f.slice(g,g+=4096));return p}function v(t,e,r){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}function k(t,e,r,i,n,s){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw RangeError('"value" argument is out of bounds');if(r+i>t.length)throw RangeError("Index out of range")}function S(t,e,r,i,n,s){if(r+i>t.length||r<0)throw RangeError("Index out of range")}function E(t,e,r,i,s){return e*=1,r>>>=0,s||S(t,e,r,4,34028234663852886e22,-34028234663852886e22),n.write(t,e,r,i,23,4),r+4}function M(t,e,r,i,s){return e*=1,r>>>=0,s||S(t,e,r,8,17976931348623157e292,-17976931348623157e292),n.write(t,e,r,i,52,8),r+8}e.Buffer=a,e.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return(l(t),t<=0)?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(B(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),B(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:+(i<r)},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);if(void 0===e)for(r=0,e=0;r<t.length;++r)e+=t[r].length;var r,i=a.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var s=t[r];if(B(s,Uint8Array))n+s.length>i.length?a.from(s).copy(i,n):Uint8Array.prototype.set.call(i,s,n);else if(a.isBuffer(s))s.copy(i,n);else throw TypeError('"list" argument must be an Array of Buffers');n+=s.length}return i},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0==arguments.length?b(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(t,e,r,i,n){if(B(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,n>>>=0,this===t)return 0;for(var s=n-i,o=r-e,u=Math.min(s,o),l=this.slice(i,n),c=t.slice(e,r),h=0;h<u;++h)if(l[h]!==c[h]){s=l[h],o=c[h];break}return s<o?-1:+(o<s)},a.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,s,o,a,u,l,c,h,f=this.length-e;if((void 0===r||r>f)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var d=!1;;)switch(i){case"hex":return function(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a,u=parseInt(e.substr(2*o,2),16);if((a=u)!=a)break;t[r+o]=u}return o}(this,t,e,r);case"utf8":case"utf-8":return n=e,s=r,_(I(t,this.length-n),this,n,s);case"ascii":case"latin1":case"binary":return o=e,a=r,_(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(t),this,o,a);case"base64":return u=e,l=r,_(x(t),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=e,h=r,_(function(t,e){for(var r,i,n=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n.push(r%256),n.push(i);return n}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||v(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return(t>>>=0,e||v(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||v(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||v(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;k(this,t,e,r,n,0)}var s=1,o=0;for(this[e]=255&t;++o<r&&(s*=256);)this[e+o]=t/s&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;k(this,t,e,r,n,0)}var s=r-1,o=1;for(this[e+s]=255&t;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,i){if(t*=1,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s<r&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+r},a.prototype.writeIntBE=function(t,e,r,i){if(t*=1,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return E(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return E(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,i){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},a.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===t.length){var n,s=t.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(t=s)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{var o=a.isBuffer(t)?t:a.from(t,i),u=o.length;if(0===u)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=o[n%u]}return this};var A=/[^+/0-9A-Za-z-_]/g;function I(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319||o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function x(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(A,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function _(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length)&&!(n>=t.length);++n)e[n+r]=t[n];return n}function B(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}var T=function(){for(var t="0123456789abcdef",e=Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)e[i+n]=t[r]+t[n];return e}()},6826:function(t,e,r){"use strict";let i=r(5186),n=r(7423),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t){var i=t,n=e;if(("string"!=typeof n||""===n)&&(n="utf8"),!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);let r=0|p(i,n),s=o(r),u=s.write(i,n);return u!==r&&(s=s.slice(0,u)),s}if(ArrayBuffer.isView(t)){var s=t;if(W(s,Uint8Array)){let t=new Uint8Array(s);return f(t.buffer,t.byteOffset,t.byteLength)}return h(s)}if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');let u=t.valueOf&&t.valueOf();if(null!=u&&u!==t)return a.from(u,e,r);let l=function(t){if(a.isBuffer(t)){let e=0|d(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||function(t){return t!=t}(t.length)?o(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(l)return l;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),o(t<0?0:0|d(t))}function h(t){let e=t.length<0?0:0|d(t.length),r=o(e);for(let i=0;i<e;i+=1)r[i]=255&t[i];return r}function f(t,e,r){let i;if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),i}function d(t){if(t>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(n)return i?-1:L(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=e;i<r;++i)n+=z[t[i]];return n}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}(this,e,r);case"latin1":case"binary":return function(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}(this,e,r);case"base64":var s,o,a;return s=this,o=e,a=r,0===o&&a===s.length?i.fromByteArray(s):i.fromByteArray(s.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){let i=t.slice(e,r),n="";for(let t=0;t<i.length-1;t+=2)n+=String.fromCharCode(i[t]+256*i[t+1]);return n}(this,e,r);default:if(n)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){var s;if(0===t.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(n)return -1;else r=t.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,i)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,i,n);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return w(t,[e],r,i,n)}throw TypeError("val must be string, number or Buffer")}function w(t,e,r,i,n){let s,o=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return -1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let i=-1;for(s=r;s<a;s++)if(l(t,s)===l(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===u)return i*o}else -1!==i&&(s-=s-i),i=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){let r=!0;for(let i=0;i<u;i++)if(l(t,s+i)!==l(e,i)){r=!1;break}if(r)return s}return -1}function b(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let e=t[n],s=null,o=e>239?4:e>223?3:e>191?2:1;if(n+o<=r){let r,i,a,u;switch(o){case 1:e<128&&(s=e);break;case 2:(192&(r=t[n+1]))==128&&(u=(31&e)<<6|63&r)>127&&(s=u);break;case 3:r=t[n+1],i=t[n+2],(192&r)==128&&(192&i)==128&&(u=(15&e)<<12|(63&r)<<6|63&i)>2047&&(u<55296||u>57343)&&(s=u);break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],(192&r)==128&&(192&i)==128&&(192&a)==128&&(u=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a)>65535&&u<1114112&&(s=u)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}var s=i;let o=s.length;if(o<=4096)return String.fromCharCode.apply(String,s);let a="",u=0;for(;u<o;)a+=String.fromCharCode.apply(String,s.slice(u,u+=4096));return a}function v(t,e,r){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}function k(t,e,r,i,n,s){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw RangeError('"value" argument is out of bounds');if(r+i>t.length)throw RangeError("Index out of range")}function S(t,e,r,i,n){T(e,i,n,t,r,7);let s=Number(e&BigInt(0xffffffff));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function E(t,e,r,i,n){T(e,i,n,t,r,7);let s=Number(e&BigInt(0xffffffff));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function M(t,e,r,i,n,s){if(r+i>t.length||r<0)throw RangeError("Index out of range")}function A(t,e,r,i,s){return e*=1,r>>>=0,s||M(t,e,r,4,34028234663852886e22,-34028234663852886e22),n.write(t,e,r,i,23,4),r+4}function I(t,e,r,i,s){return e*=1,r>>>=0,s||M(t,e,r,8,17976931348623157e292,-17976931348623157e292),n.write(t,e,r,i,52,8),r+8}e.Buffer=a,e.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return(l(t),t<=0)?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(W(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:+(i<r)},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){let r;if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);if(void 0===e)for(r=0,e=0;r<t.length;++r)e+=t[r].length;let i=a.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))n+e.length>i.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else if(a.isBuffer(e))e.copy(i,n);else throw TypeError('"list" argument must be an Array of Buffers');n+=e.length}return i},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){let t=this.length;return 0===t?"":0==arguments.length?b(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(t,e,r,i,n){if(W(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,n>>>=0,this===t)return 0;let s=n-i,o=r-e,u=Math.min(s,o),l=this.slice(i,n),c=t.slice(e,r);for(let t=0;t<u;++t)if(l[t]!==c[t]){s=l[t],o=c[t];break}return s<o?-1:+(o<s)},a.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,i){var n,s,o,a,u,l,c,h;if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-e;if((void 0===r||r>f)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let d=!1;for(;;)switch(i){case"hex":return function(t,e,r,i){let n;r=Number(r)||0;let s=t.length-r;i?(i=Number(i))>s&&(i=s):i=s;let o=e.length;for(i>o/2&&(i=o/2),n=0;n<i;++n){var a;let i=parseInt(e.substr(2*n,2),16);if((a=i)!=a)break;t[r+n]=i}return n}(this,t,e,r);case"utf8":case"utf-8":return n=e,s=r,O(L(t,this.length-n),this,n,s);case"ascii":case"latin1":case"binary":return o=e,a=r,O(function(t){let e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(t),this,o,a);case"base64":return u=e,l=r,O(U(t),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=e,h=r,O(function(t,e){let r,i,n=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n.push(r%256),n.push(i);return n}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(t,e){let r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||v(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&R(t,this.length-8);let i=e+256*this[++t]+65536*this[++t]+0x1000000*this[++t],n=this[++t]+256*this[++t]+65536*this[++t]+0x1000000*r;return BigInt(i)+(BigInt(n)<<BigInt(32))}),a.prototype.readBigUInt64BE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&R(t,this.length-8);let i=0x1000000*e+65536*this[++t]+256*this[++t]+this[++t],n=0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)}),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return(t>>>=0,e||v(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||v(t,2,this.length);let r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||v(t,2,this.length);let r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&R(t,this.length-8),(BigInt(this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24))<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+0x1000000*this[++t])}),a.prototype.readBigInt64BE=N(function(t){C(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&R(t,this.length-8),(BigInt((e<<24)+65536*this[++t]+256*this[++t]+this[++t])<<BigInt(32))+BigInt(0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r)}),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}let n=1,s=0;for(this[e]=255&t;++s<r&&(n*=256);)this[e+s]=t/n&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,i){if(t*=1,e>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=N(function(t,e=0){return S(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=N(function(t,e=0){return E(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(t,e,r,i){if(t*=1,e>>>=0,!i){let i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}let n=0,s=1,o=0;for(this[e]=255&t;++n<r&&(s*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},a.prototype.writeIntBE=function(t,e,r,i){if(t*=1,e>>>=0,!i){let i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/s|0)-o&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||k(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=N(function(t,e=0){return S(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=N(function(t,e=0){return E(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(t,e,r){return A(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return A(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,i){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);let n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},a.prototype.fill=function(t,e,r,i){let n;if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===t.length){let e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{let s=a.isBuffer(t)?t:a.from(t,i),o=s.length;if(0===o)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=s[n%o]}return this};let x={};function _(t,e,r){x[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function B(t){let e="",r=t.length,i=+("-"===t[0]);for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function T(t,e,r,i,n,s){if(t>r||t<e){let i,n="bigint"==typeof e?"n":"";throw i=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${(s+1)*8}${n}`:`>= -(2${n} ** ${(s+1)*8-1}${n}) and < 2 ** ${(s+1)*8-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new x.ERR_OUT_OF_RANGE("value",i,t)}C(n,"offset"),(void 0===i[n]||void 0===i[n+s])&&R(n,i.length-(s+1))}function C(t,e){if("number"!=typeof t)throw new x.ERR_INVALID_ARG_TYPE(e,"number",t)}function R(t,e,r){if(Math.floor(t)!==t)throw C(t,r),new x.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new x.ERR_BUFFER_OUT_OF_BOUNDS;throw new x.ERR_OUT_OF_RANGE(r||"offset",`>= ${+!!r} and <= ${e}`,t)}_("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),_("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),_("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?n=B(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=B(n)),n+="n"),i+=` It must be ${e}. Received ${n}`},RangeError);let P=/[^+/0-9A-Za-z-_]/g;function L(t,e){let r;e=e||1/0;let i=t.length,n=null,s=[];for(let o=0;o<i;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319||o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function U(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function O(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length)&&!(n>=t.length);++n)e[n+r]=t[n];return n}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}let z=function(){let t="0123456789abcdef",e=Array(256);for(let r=0;r<16;++r){let i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function N(t){return"undefined"==typeof BigInt?j:t}function j(){throw Error("BigInt not supported")}},2466:function(t,e,r){"use strict";let i=r(1876).v4,n=r(5325),s=function(t,e){if(!(this instanceof s))return new s(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return i()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};t.exports=s,s.prototype.request=function(t,e,r,i){let s,o=this,a=null,u=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&u)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!u&&t&&"object"==typeof t&&"function"==typeof e;if(u||l)i=e,a=t;else{"function"==typeof r&&(i=r,r=void 0);let s="function"==typeof i;try{a=n(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(s)return i(t);throw t}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(t){return i(t)}return this.callServer(s,function(t,e){o._parseResponse(t,e,i)}),a},s.prototype._parseResponse=function(t,e,r){let i;if(t)return void r(t);if(!e)return r();try{i=JSON.parse(e,this.options.reviver)}catch(t){return r(t)}if(3===r.length)if(!Array.isArray(i))return r(null,i.error,i.result);else{let t=function(t){return void 0!==t.error};return r(null,i.filter(t),i.filter(function(e){return!t(e)}))}r(null,i)}},5325:function(t,e,r){"use strict";let i=r(1876).v4;t.exports=function(t,e,r,n){if("string"!=typeof t)throw TypeError(t+" must be a string");let s="number"==typeof(n=n||{}).version?n.version:2;if(1!==s&&2!==s)throw TypeError(s+" must be 1 or 2");let o={method:t};if(2===s&&(o.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw TypeError(e+" must be an object, array or omitted");o.params=e}return void 0===r?o.id=("function"==typeof n.generator?n.generator:function(){return i()})(o,n):2===s&&null===r?n.notificationIdNull&&(o.id=null):o.id=r,o}},8817:function(t,e,r){let i=r(6675),n=r(9643),s=r(1745),o=r(2550);function a(t,e,r,s,o){let a=[].slice.call(arguments,1),u=a.length,l="function"==typeof a[u-1];if(!l&&!i())throw Error("Callback required as last argument");if(l){if(u<2)throw Error("Too few arguments provided");2===u?(o=r,r=e,e=s=void 0):3===u&&(e.getContext&&void 0===o?(o=s,s=void 0):(o=s,s=r,r=e,e=void 0))}else{if(u<1)throw Error("Too few arguments provided");return 1===u?(r=e,e=s=void 0):2!==u||e.getContext||(s=r,r=e,e=void 0),new Promise(function(i,o){try{let o=n.create(r,s);i(t(o,e,s))}catch(t){o(t)}})}try{let i=n.create(r,s);o(null,t(i,e,s))}catch(t){o(t)}}e.create=n.create,e.toCanvas=a.bind(null,s.render),e.toDataURL=a.bind(null,s.renderToDataURL),e.toString=a.bind(null,function(t,e,r){return o.render(t,r)})},6675:function(t){t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},3559:function(t,e,r){let i=r(1984).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];let e=Math.floor(t/7)+2,r=i(t),n=145===r?26:2*Math.ceil((r-13)/(2*e-2)),s=[r-7];for(let t=1;t<e-1;t++)s[t]=s[t-1]-n;return s.push(6),s.reverse()},e.getPositions=function(t){let r=[],i=e.getRowColCoords(t),n=i.length;for(let t=0;t<n;t++)for(let e=0;e<n;e++)(0!==t||0!==e)&&(0!==t||e!==n-1)&&(t!==n-1||0!==e)&&r.push([i[t],i[e]]);return r}},1523:function(t,e,r){let i=r(3670),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(t){this.mode=i.ALPHANUMERIC,this.data=t}s.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=45*n.indexOf(this.data[e]);r+=n.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(n.indexOf(this.data[e]),6)},t.exports=s},9745:function(t){function e(){this.buffer=[],this.length=0}e.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=e},742:function(t){function e(t){if(!t||t<1)throw Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}e.prototype.set=function(t,e,r,i){let n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)},e.prototype.get=function(t,e){return this.data[t*this.size+e]},e.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},e.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},t.exports=e},6920:function(t,e,r){let i=r(3670);function n(t){this.mode=i.BYTE,"string"==typeof t?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)},t.exports=n},4936:function(t,e,r){let i=r(4059),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(t,e){switch(e){case i.L:return n[(t-1)*4+0];case i.M:return n[(t-1)*4+1];case i.Q:return n[(t-1)*4+2];case i.H:return n[(t-1)*4+3];default:return}},e.getTotalCodewordsCount=function(t,e){switch(e){case i.L:return s[(t-1)*4+0];case i.M:return s[(t-1)*4+1];case i.Q:return s[(t-1)*4+2];case i.H:return s[(t-1)*4+3];default:return}}},4059:function(t,e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{if("string"!=typeof t)throw Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw Error("Unknown EC Level: "+t)}}catch(t){return r}}},370:function(t,e,r){let i=r(1984).getSymbolSize;e.getPositions=function(t){let e=i(t);return[[0,0],[e-7,0],[0,e-7]]}},1547:function(t,e,r){let i=r(1984),n=i.getBCHDigit(1335);e.getEncodedBits=function(t,e){let r=t.bit<<3|e,s=r<<10;for(;i.getBCHDigit(s)-n>=0;)s^=1335<<i.getBCHDigit(s)-n;return(r<<10|s)^21522}},6069:function(t,e){let r=new Uint8Array(512),i=new Uint8Array(256),n=1;for(let t=0;t<255;t++)r[t]=n,i[n]=t,256&(n<<=1)&&(n^=285);for(let t=255;t<512;t++)r[t]=r[t-255];e.log=function(t){if(t<1)throw Error("log("+t+")");return i[t]},e.exp=function(t){return r[t]},e.mul=function(t,e){return 0===t||0===e?0:r[i[t]+i[e]]}},6499:function(t,e,r){let i=r(3670),n=r(1984);function s(t){this.mode=i.KANJI,this.data=t}s.getBitsLength=function(t){return 13*t},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=n.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");r=(r>>>8&255)*192+(255&r),t.put(r,13)}},t.exports=s},3238:function(t,e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};e.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){let e=t.size,r=0,i=0,n=0,s=null,o=null;for(let a=0;a<e;a++){i=n=0,s=o=null;for(let u=0;u<e;u++){let e=t.get(a,u);e===s?i++:(i>=5&&(r+=3+(i-5)),s=e,i=1),(e=t.get(u,a))===o?n++:(n>=5&&(r+=3+(n-5)),o=e,n=1)}i>=5&&(r+=3+(i-5)),n>=5&&(r+=3+(n-5))}return r},e.getPenaltyN2=function(t){let e=t.size,r=0;for(let i=0;i<e-1;i++)for(let n=0;n<e-1;n++){let e=t.get(i,n)+t.get(i,n+1)+t.get(i+1,n)+t.get(i+1,n+1);(4===e||0===e)&&r++}return 3*r},e.getPenaltyN3=function(t){let e=t.size,r=0,i=0,n=0;for(let s=0;s<e;s++){i=n=0;for(let o=0;o<e;o++)i=i<<1&2047|t.get(s,o),o>=10&&(1488===i||93===i)&&r++,n=n<<1&2047|t.get(o,s),o>=10&&(1488===n||93===n)&&r++}return 40*r},e.getPenaltyN4=function(t){let e=0,r=t.data.length;for(let i=0;i<r;i++)e+=t.data[i];return 10*Math.abs(Math.ceil(100*e/r/5)-10)},e.applyMask=function(t,r){let i=r.size;for(let n=0;n<i;n++)for(let s=0;s<i;s++)r.isReserved(s,n)||r.xor(s,n,function(t,r,i){switch(t){case e.Patterns.PATTERN000:return(r+i)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return i%3==0;case e.Patterns.PATTERN011:return(r+i)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(i/3))%2==0;case e.Patterns.PATTERN101:return r*i%2+r*i%3==0;case e.Patterns.PATTERN110:return(r*i%2+r*i%3)%2==0;case e.Patterns.PATTERN111:return(r*i%3+(r+i)%2)%2==0;default:throw Error("bad maskPattern:"+t)}}(t,s,n))},e.getBestMask=function(t,r){let i=Object.keys(e.Patterns).length,n=0,s=1/0;for(let o=0;o<i;o++){r(o),e.applyMask(o,t);let i=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),i<s&&(s=i,n=o)}return n}},3670:function(t,e,r){let i=r(9700),n=r(34);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw Error("Invalid mode: "+t);if(!i.isValid(e))throw Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{if("string"!=typeof t)throw Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw Error("Unknown mode: "+t)}}catch(t){return r}}},1515:function(t,e,r){let i=r(3670);function n(t){this.mode=i.NUMERIC,this.data=t.toString()}n.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){let e,r;for(e=0;e+3<=this.data.length;e+=3)r=parseInt(this.data.substr(e,3),10),t.put(r,10);let i=this.data.length-e;i>0&&(r=parseInt(this.data.substr(e),10),t.put(r,3*i+1))},t.exports=n},9687:function(t,e,r){let i=r(6069);e.mul=function(t,e){let r=new Uint8Array(t.length+e.length-1);for(let n=0;n<t.length;n++)for(let s=0;s<e.length;s++)r[n+s]^=i.mul(t[n],e[s]);return r},e.mod=function(t,e){let r=new Uint8Array(t);for(;r.length-e.length>=0;){let t=r[0];for(let n=0;n<e.length;n++)r[n]^=i.mul(e[n],t);let n=0;for(;n<r.length&&0===r[n];)n++;r=r.slice(n)}return r},e.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=e.mul(r,new Uint8Array([1,i.exp(n)]));return r}},9643:function(t,e,r){let i=r(1984),n=r(4059),s=r(9745),o=r(742),a=r(3559),u=r(370),l=r(3238),c=r(4936),h=r(3014),f=r(8861),d=r(1547),p=r(3670),g=r(4259);function m(t,e,r){let i,n,s=t.size,o=d.getEncodedBits(e,r);for(i=0;i<15;i++)n=(o>>i&1)==1,i<6?t.set(i,8,n,!0):i<8?t.set(i+1,8,n,!0):t.set(s-15+i,8,n,!0),i<8?t.set(8,s-i-1,n,!0):i<9?t.set(8,15-i-1+1,n,!0):t.set(8,15-i-1,n,!0);t.set(s-8,8,1,!0)}e.create=function(t,e){let r,d;if(void 0===t||""===t)throw Error("No input text");let y=n.M;return void 0!==e&&(y=n.from(e.errorCorrectionLevel,n.M),r=f.from(e.version),d=l.from(e.maskPattern),e.toSJISFunc&&i.setToSJISFunction(e.toSJISFunc)),function(t,e,r,n){let d;if(Array.isArray(t))d=g.fromArray(t);else if("string"==typeof t){let i=e;if(!i){let e=g.rawSplit(t);i=f.getBestVersionForData(e,r)}d=g.fromString(t,i||40)}else throw Error("Invalid data");let y=f.getBestVersionForData(d,r);if(!y)throw Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<y)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else e=y;let w=function(t,e,r){let n=new s;r.forEach(function(e){n.put(e.mode.bit,4),n.put(e.getLength(),p.getCharCountIndicator(e.mode,t)),e.write(n)});let o=(i.getSymbolTotalCodewords(t)-c.getTotalCodewordsCount(t,e))*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let t=0;t<a;t++)n.put(t%2?17:236,8);return function(t,e,r){let n,s,o=i.getSymbolTotalCodewords(e),a=o-c.getTotalCodewordsCount(e,r),u=c.getBlocksCount(e,r),l=o%u,f=u-l,d=Math.floor(o/u),p=Math.floor(a/u),g=p+1,m=d-p,y=new h(m),w=0,b=Array(u),v=Array(u),k=0,S=new Uint8Array(t.buffer);for(let t=0;t<u;t++){let e=t<f?p:g;b[t]=S.slice(w,w+e),v[t]=y.encode(b[t]),w+=e,k=Math.max(k,e)}let E=new Uint8Array(o),M=0;for(n=0;n<k;n++)for(s=0;s<u;s++)n<b[s].length&&(E[M++]=b[s][n]);for(n=0;n<m;n++)for(s=0;s<u;s++)E[M++]=v[s][n];return E}(n,t,e)}(e,r,d),b=new o(i.getSymbolSize(e));!function(t,e){let r=t.size,i=u.getPositions(e);for(let e=0;e<i.length;e++){let n=i[e][0],s=i[e][1];for(let e=-1;e<=7;e++)if(!(n+e<=-1)&&!(r<=n+e))for(let i=-1;i<=7;i++)s+i<=-1||r<=s+i||(e>=0&&e<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===e||6===e)||e>=2&&e<=4&&i>=2&&i<=4?t.set(n+e,s+i,!0,!0):t.set(n+e,s+i,!1,!0))}}(b,e);let v=b.size;for(let t=8;t<v-8;t++){let e=t%2==0;b.set(t,6,e,!0),b.set(6,t,e,!0)}return!function(t,e){let r=a.getPositions(e);for(let e=0;e<r.length;e++){let i=r[e][0],n=r[e][1];for(let e=-2;e<=2;e++)for(let r=-2;r<=2;r++)-2===e||2===e||-2===r||2===r||0===e&&0===r?t.set(i+e,n+r,!0,!0):t.set(i+e,n+r,!1,!0)}}(b,e),m(b,r,0),e>=7&&function(t,e){let r,i,n,s=t.size,o=f.getEncodedBits(e);for(let e=0;e<18;e++)r=Math.floor(e/3),i=e%3+s-8-3,n=(o>>e&1)==1,t.set(r,i,n,!0),t.set(i,r,n,!0)}(b,e),!function(t,e){let r=t.size,i=-1,n=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!t.isReserved(n,a-r)){let i=!1;o<e.length&&(i=(e[o]>>>s&1)==1),t.set(n,a-r,i),-1==--s&&(o++,s=7)}if((n+=i)<0||r<=n){n-=i,i=-i;break}}}(b,w),isNaN(n)&&(n=l.getBestMask(b,m.bind(null,b,r))),l.applyMask(n,b),m(b,r,n),{modules:b,version:e,errorCorrectionLevel:r,maskPattern:n,segments:d}}(t,r,y,d)}},3014:function(t,e,r){let i=r(9687);function n(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(t){this.degree=t,this.genPoly=i.generateECPolynomial(this.degree)},n.prototype.encode=function(t){if(!this.genPoly)throw Error("Encoder not initialized");let e=new Uint8Array(t.length+this.degree);e.set(t);let r=i.mod(e,this.genPoly),n=this.degree-r.length;if(n>0){let t=new Uint8Array(this.degree);return t.set(r,n),t}return r},t.exports=n},34:function(t,e){let r="[0-9]+",i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(i=i.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";e.KANJI=RegExp(i,"g"),e.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),e.BYTE=RegExp(n,"g"),e.NUMERIC=RegExp(r,"g"),e.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let s=RegExp("^"+i+"$"),o=RegExp("^"+r+"$"),a=RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(t){return s.test(t)},e.testNumeric=function(t){return o.test(t)},e.testAlphanumeric=function(t){return a.test(t)}},4259:function(t,e,r){let i=r(3670),n=r(1515),s=r(1523),o=r(6920),a=r(6499),u=r(34),l=r(1984),c=r(4993);function h(t){return unescape(encodeURIComponent(t)).length}function f(t,e,r){let i,n=[];for(;null!==(i=t.exec(r));)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function d(t){let e,r,n=f(u.NUMERIC,i.NUMERIC,t),s=f(u.ALPHANUMERIC,i.ALPHANUMERIC,t);return l.isKanjiModeEnabled()?(e=f(u.BYTE,i.BYTE,t),r=f(u.KANJI,i.KANJI,t)):(e=f(u.BYTE_KANJI,i.BYTE,t),r=[]),n.concat(s,e,r).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function p(t,e){switch(e){case i.NUMERIC:return n.getBitsLength(t);case i.ALPHANUMERIC:return s.getBitsLength(t);case i.KANJI:return a.getBitsLength(t);case i.BYTE:return o.getBitsLength(t)}}function g(t,e){let r,u=i.getBestModeForData(t);if((r=i.from(e,u))!==i.BYTE&&r.bit<u.bit)throw Error('"'+t+'" cannot be encoded with mode '+i.toString(r)+".\n Suggested mode is: "+i.toString(u));switch(r===i.KANJI&&!l.isKanjiModeEnabled()&&(r=i.BYTE),r){case i.NUMERIC:return new n(t);case i.ALPHANUMERIC:return new s(t);case i.KANJI:return new a(t);case i.BYTE:return new o(t)}}e.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(g(e,null)):e.data&&t.push(g(e.data,e.mode)),t},[])},e.fromString=function(t,r){let n=function(t,e){let r={},n={start:{}},s=["start"];for(let o=0;o<t.length;o++){let a=t[o],u=[];for(let t=0;t<a.length;t++){let l=a[t],c=""+o+t;u.push(c),r[c]={node:l,lastCount:0},n[c]={};for(let t=0;t<s.length;t++){let o=s[t];r[o]&&r[o].node.mode===l.mode?(n[o][c]=p(r[o].lastCount+l.length,l.mode)-p(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),n[o][c]=p(l.length,l.mode)+4+i.getCharCountIndicator(l.mode,e))}}s=u}for(let t=0;t<s.length;t++)n[s[t]].end=0;return{map:n,table:r}}(function(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];switch(n.mode){case i.NUMERIC:e.push([n,{data:n.data,mode:i.ALPHANUMERIC,length:n.length},{data:n.data,mode:i.BYTE,length:n.length}]);break;case i.ALPHANUMERIC:e.push([n,{data:n.data,mode:i.BYTE,length:n.length}]);break;case i.KANJI:e.push([n,{data:n.data,mode:i.BYTE,length:h(n.data)}]);break;case i.BYTE:e.push([{data:n.data,mode:i.BYTE,length:h(n.data)}])}}return e}(d(t,l.isKanjiModeEnabled())),r),s=c.find_path(n.map,"start","end"),o=[];for(let t=1;t<s.length-1;t++)o.push(n.table[s[t]].node);return e.fromArray(o.reduce(function(t,e){let r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?t[t.length-1].data+=e.data:t.push(e),t},[]))},e.rawSplit=function(t){return e.fromArray(d(t,l.isKanjiModeEnabled()))}},1984:function(t,e){let r,i=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw Error('"version" cannot be null or undefined');if(t<1||t>40)throw Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return i[t]},e.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw Error('"toSJISFunc" is not a valid function.');r=t},e.isKanjiModeEnabled=function(){return void 0!==r},e.toSJIS=function(t){return r(t)}},9700:function(t,e){e.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}},8861:function(t,e,r){let i=r(1984),n=r(4936),s=r(4059),o=r(3670),a=r(9700),u=i.getBCHDigit(7973);function l(t,e){return o.getCharCountIndicator(t,e)+4}e.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},e.getCapacity=function(t,e,r){if(!a.isValid(t))throw Error("Invalid QR Code version");void 0===r&&(r=o.BYTE);let s=(i.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,e))*8;if(r===o.MIXED)return s;let u=s-l(r,t);switch(r){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){let i,n=s.from(r,s.M);if(Array.isArray(t)){if(t.length>1){for(let r=1;r<=40;r++)if(function(t,e){let r=0;return t.forEach(function(t){let i=l(t.mode,e);r+=i+t.getBitsLength()}),r}(t,r)<=e.getCapacity(r,n,o.MIXED))return r;return}if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,i){for(let n=1;n<=40;n++)if(r<=e.getCapacity(n,i,t))return n}(i.mode,i.getLength(),n)},e.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw Error("Invalid QR Code version");let e=t<<12;for(;i.getBCHDigit(e)-u>=0;)e^=7973<<i.getBCHDigit(e)-u;return t<<12|e}},1745:function(t,e,r){let i=r(6892);e.render=function(t,e,r){var n;let s=r,o=e;void 0!==s||e&&e.getContext||(s=e,e=void 0),e||(o=function(){try{return document.createElement("canvas")}catch(t){throw Error("You need to specify a canvas element")}}()),s=i.getOptions(s);let a=i.getImageWidth(t.modules.size,s),u=o.getContext("2d"),l=u.createImageData(a,a);return i.qrToImageData(l.data,t,s),n=o,u.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=a,n.width=a,n.style.height=a+"px",n.style.width=a+"px",u.putImageData(l,0,0),o},e.renderToDataURL=function(t,r,i){let n=i;void 0!==n||r&&r.getContext||(n=r,r=void 0),n||(n={});let s=e.render(t,r,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}},2550:function(t,e,r){let i=r(6892);function n(t,e){let r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function s(t,e,r){let i=t+e;return void 0!==r&&(i+=" "+r),i}e.render=function(t,e,r){let o=i.getOptions(e),a=t.modules.size,u=t.modules.data,l=a+2*o.margin,c=o.color.light.a?"<path "+n(o.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+n(o.color.dark,"stroke")+' d="'+function(t,e,r){let i="",n=0,o=!1,a=0;for(let u=0;u<t.length;u++){let l=Math.floor(u%e),c=Math.floor(u/e);l||o||(o=!0),t[u]?(a++,u>0&&l>0&&t[u-1]||(i+=o?s("M",l+r,.5+c+r):s("m",n,0),n=0,o=!1),l+1<e&&t[u+1]||(i+=s("h",a),a=0)):n++}return i}(u,a,o.margin)+'"/>',f='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+('viewBox="0 0 '+l+" ")+l+'" shape-rendering="crispEdges">'+c+h+"</svg>\n";return"function"==typeof r&&r(null,f),f}},6892:function(t,e){function r(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw Error("Invalid hex color: "+t);(3===e.length||4===e.length)&&(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+e.slice(0,6).join("")}}e.getOptions=function(t){t||(t={}),t.color||(t.color={});let e=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,i=t.width&&t.width>=21?t.width:void 0,n=t.scale||4;return{width:i,scale:i?4:n,margin:e,color:{dark:r(t.color.dark||"#000000ff"),light:r(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},e.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},e.getImageWidth=function(t,r){let i=e.getScale(t,r);return Math.floor((t+2*r.margin)*i)},e.qrToImageData=function(t,r,i){let n=r.modules.size,s=r.modules.data,o=e.getScale(n,i),a=Math.floor((n+2*i.margin)*o),u=i.margin*o,l=[i.color.light,i.color.dark];for(let e=0;e<a;e++)for(let r=0;r<a;r++){let c=(e*a+r)*4,h=i.color.light;e>=u&&r>=u&&e<a-u&&r<a-u&&(h=l[+!!s[Math.floor((e-u)/o)*n+Math.floor((r-u)/o)]]),t[c++]=h.r,t[c++]=h.g,t[c++]=h.b,t[c]=h.a}}},3112:function(){},6198:function(t,e,r){"use strict";r.d(e,{Ce:()=>a,Ok:()=>n});var i,n,s=r(9977),o=r(7858);(i=n||(n={})).Installed="Installed",i.NotDetected="NotDetected",i.Loadable="Loadable",i.Unsupported="Unsupported";class a extends s.A{get connected(){return!!this.publicKey}async autoConnect(){await this.connect()}async prepareTransaction(t,e,r={}){let i=this.publicKey;if(!i)throw new o.kW;return t.feePayer=t.feePayer||i,t.recentBlockhash=t.recentBlockhash||(await e.getLatestBlockhash({commitment:r.preflightCommitment,minContextSlot:r.minContextSlot})).blockhash,t}}},7858:function(t,e,r){"use strict";r.d(e,{AE:()=>n,Ez:()=>s,K3:()=>p,Kd:()=>c,PQ:()=>a,UF:()=>f,Y6:()=>o,Y8:()=>u,fk:()=>l,kW:()=>h,m7:()=>i,o7:()=>g,z4:()=>d});class i extends Error{constructor(t,e){super(t),this.error=e}}class n extends i{constructor(){super(...arguments),this.name="WalletNotReadyError"}}class s extends i{constructor(){super(...arguments),this.name="WalletConfigError"}}class o extends i{constructor(){super(...arguments),this.name="WalletConnectionError"}}class a extends i{constructor(){super(...arguments),this.name="WalletDisconnectedError"}}class u extends i{constructor(){super(...arguments),this.name="WalletDisconnectionError"}}class l extends i{constructor(){super(...arguments),this.name="WalletAccountError"}}class c extends i{constructor(){super(...arguments),this.name="WalletPublicKeyError"}}class h extends i{constructor(){super(...arguments),this.name="WalletNotConnectedError"}}class f extends i{constructor(){super(...arguments),this.name="WalletSendTransactionError"}}class d extends i{constructor(){super(...arguments),this.name="WalletSignTransactionError"}}class p extends i{constructor(){super(...arguments),this.name="WalletSignMessageError"}}class g extends i{constructor(){super(...arguments),this.name="WalletSignInError"}}},3480:function(t,e,r){"use strict";r.d(e,{S:()=>o});var i=r(9836),n=r(5074),s=r(3114);let o=({children:t,endpoint:e,config:r={commitment:"confirmed"}})=>{let o=(0,n.useMemo)(()=>new i.Ng(e,r),[e,r]);return n.createElement(s.E.Provider,{value:{connection:o}},t)}},5681:function(t,e,r){"use strict";let i,n,s,o;r.d(e,{r:()=>eJ});var a,u,l,c,h,f,d,p,g,m,y,w,b,v,k,S,E,M,A,I,x,_,B,T,C,R,P,L,U,O,W,z,N,j,K,q,D,$,F,H,V,J,Y,Z,G,Q,X,tt,te,tr,ti,tn,ts,to,ta,tu,tl,tc,th,tf,td,tp,tg,tm,ty,tw,tb,tv,tk,tS,tE,tM,tA,tI,tx,t_,tB=r(6198),tT=r(7858);function tC(t){return"version"in t}class tR extends tB.Ce{async sendTransaction(t,e,r={}){let i=!0;try{if(tC(t)){if(!this.supportedTransactionVersions)throw new tT.UF("Sending versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(t.version))throw new tT.UF(`Sending transaction version ${t.version} isn't supported by this wallet`);try{let i=(t=await this.signTransaction(t)).serialize();return await e.sendRawTransaction(i,r)}catch(t){if(t instanceof tT.z4)throw i=!1,t;throw new tT.UF(t?.message,t)}}try{let{signers:i,...n}=r;t=await this.prepareTransaction(t,e,n),i?.length&&t.partialSign(...i);let s=(t=await this.signTransaction(t)).serialize();return await e.sendRawTransaction(s,n)}catch(t){if(t instanceof tT.z4)throw i=!1,t;throw new tT.UF(t?.message,t)}}catch(t){throw i&&this.emit("error",t),t}}async signAllTransactions(t){for(let e of t)if(tC(e)){if(!this.supportedTransactionVersions)throw new tT.z4("Signing versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(e.version))throw new tT.z4(`Signing transaction version ${e.version} isn't supported by this wallet`)}let e=[];for(let r of t)e.push(await this.signTransaction(r));return e}}class tP extends tR{}class tL extends tP{}var tU=r(9836);let tO="solana:signIn",tW="solana:signMessage",tz="solana:signAndSendTransaction",tN="solana:signTransaction";r(8817);let tj=`(?:\\nURI: (?<uri>[^\\n]+))?(?:\\nVersion: (?<version>[^\\n]+))?(?:\\nChain ID: (?<chainId>[^\\n]+))?(?:\\nNonce: (?<nonce>[^\\n]+))?(?:\\nIssued At: (?<issuedAt>[^\\n]+))?(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?(?:\\nNot Before: (?<notBefore>[^\\n]+))?(?:\\nRequest ID: (?<requestId>[^\\n]+))?(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?`;RegExp(`^(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n(?<address>[^\\n]+)(?:\\n|$)(?:\\n(?<statement>[\\S\\s]*?)(?:\\n|$))??${tj}\\n*$`);let tK="ERROR_FORBIDDEN_WALLET_BASE_URL";class tq extends Error{constructor(...t){const[e,r,i]=t;super(r),this.code=e,this.data=i,this.name="SolanaMobileWalletAdapterError"}}class tD extends Error{constructor(...t){const[e,r,i,n]=t;super(i),this.code=r,this.data=n,this.jsonRpcMessageId=e,this.name="SolanaMobileWalletAdapterProtocolError"}}function t$(t,e,r,i){return new(r||(r=Promise))(function(n,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?n(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(o,a)}u((i=i.apply(t,e||[])).next())})}function tF(t,e){let r=window.btoa(String.fromCharCode.call(null,...t));return e?r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):r}function tH(t){return new Uint8Array(window.atob(t).split("").map(t=>t.charCodeAt(0)))}function tV(t,e){return t$(this,void 0,void 0,function*(){let r=yield crypto.subtle.exportKey("raw",t),i=yield crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},e,r),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(new Uint8Array(r),0),n.set(new Uint8Array(i),r.byteLength),n})}let tJ="solana:cloneAuthorization";function tY(t,e){return t$(this,void 0,void 0,function*(){let r=t.slice(0,4),n=t.slice(4,16),s=t.slice(16),o=yield crypto.subtle.decrypt(tZ(r,n),e,s);return(void 0===i&&(i=new TextDecoder("utf-8")),i).decode(o)})}function tZ(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function tG(){return t$(this,void 0,void 0,function*(){return yield crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"])})}function tQ(t){if(t<49152||t>65535)throw new tq("ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",`Association port number must be between 49152 and 65535. ${t} given.`,{port:t});return t}function tX(t){return t.replace(/(^\/+|\/+$)/g,"").split("/")}let t0=null,t1=[150,150,200,500,500,750,750,1e3];function t2(t){return new DataView(t).getUint32(0,!1)}let t6="standard:connect",t3="standard:disconnect",t8="standard:events";var t5=r(9774),t4=r(1899);function t9(t,e,r,i){return new(r||(r=Promise))(function(n,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?n(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(o,a)}u((i=i.apply(t,e||[])).next())})}function t7(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)}function et(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r}let ee=`
|
|
8
8
|
<div class="mobile-wallet-adapter-embedded-modal-container" role="dialog" aria-modal="true" aria-labelledby="modal-title">
|
|
9
9
|
<div data-modal-close style="position: absolute; width: 100%; height: 100%;"></div>
|
|
10
10
|
<div class="mobile-wallet-adapter-embedded-modal-card">
|
|
@@ -140,4 +140,4 @@ ${r.join("\n")}`),e}(Object.assign(Object.assign({},t),{domain:u,address:(n=tH(l
|
|
|
140
140
|
margin-left: 12px;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
`,ed="SolanaMobileWalletAdapterDefaultAuthorizationCache";function ep(t,e,r,i){return new(r||(r=Promise))(function(n,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?n(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(o,a)}u((i=i.apply(t,e||[])).next())})}function eg(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)}function em(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r}let ey="standard:connect";function ew(t){return window.btoa(String.fromCharCode.call(null,...t))}function eb(t){switch(t){case"mainnet-beta":return"solana:mainnet";case"testnet":return"solana:testnet";case"devnet":return"solana:devnet";default:return t}}class ev extends tL{constructor(t,e){super(),Z.add(this),this.supportedTransactionVersions=new Set(["legacy",0]),G.set(this,void 0),Q.set(this,!1),X.set(this,"undefined"!=typeof window&&window.isSecureContext&&"undefined"!=typeof document&&/android/i.test(navigator.userAgent)?tB.Ok.Loadable:tB.Ok.Unsupported),tt.set(this,void 0),te.set(this,void 0),tr.set(this,void 0),ti.set(this,t=>ep(this,void 0,void 0,function*(){if(t.accounts&&t.accounts.length>0){eg(this,Z,"m",ts).call(this);let e=yield eg(this,tt,"f").call(this,t.accounts);e!==eg(this,te,"f")&&(em(this,te,e,"f"),em(this,tr,void 0,"f"),this.emit("connect",this.publicKey))}})),em(this,tt,t=>ep(this,void 0,void 0,function*(){var r;let i=yield e.addressSelector.select(t.map(({publicKey:t})=>ew(t)));return null!=(r=t.find(({publicKey:t})=>ew(t)===i))?r:t[0]}),"f"),em(this,G,t,"f"),eg(this,G,"f").features["standard:events"].on("change",eg(this,ti,"f")),this.name=eg(this,G,"f").name,this.icon=eg(this,G,"f").icon,this.url=eg(this,G,"f").url}get publicKey(){var t;if(!eg(this,tr,"f")&&eg(this,te,"f"))try{em(this,tr,new tU.J3(eg(this,te,"f").publicKey),"f")}catch(t){throw new tT.Kd(t instanceof Error&&(null==t?void 0:t.message)||"Unknown error",t)}return null!=(t=eg(this,tr,"f"))?t:null}get connected(){return eg(this,G,"f").connected}get connecting(){return eg(this,Q,"f")}get readyState(){return eg(this,X,"f")}autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(){return ep(this,void 0,void 0,function*(){return yield this.autoConnect()})}autoConnect(){return ep(this,void 0,void 0,function*(){eg(this,Z,"m",tn).call(this,!0)})}connect(){return ep(this,void 0,void 0,function*(){eg(this,Z,"m",tn).call(this)})}performAuthorization(t){return ep(this,void 0,void 0,function*(){try{let e=yield eg(this,G,"f").cachedAuthorizationResult;if(e)return yield eg(this,G,"f").features[ey].connect({silent:!0}),e;return t?yield eg(this,G,"f").features[tO].signIn(t):yield eg(this,G,"f").features[ey].connect(),yield yield eg(this,G,"f").cachedAuthorizationResult}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}})}disconnect(){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){em(this,Q,!1,"f"),em(this,tr,void 0,"f"),em(this,te,void 0,"f"),yield eg(this,G,"f").features["standard:disconnect"].disconnect(),this.emit("disconnect")}))})}signIn(t){return ep(this,void 0,void 0,function*(){return eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){var e;if(eg(this,X,"f")!==tB.Ok.Installed&&eg(this,X,"f")!==tB.Ok.Loadable)throw new tT.AE;em(this,Q,!0,"f");try{let r=yield eg(this,G,"f").features[tO].signIn(Object.assign(Object.assign({},t),{domain:null!=(e=null==t?void 0:t.domain)?e:window.location.host}));if(r.length>0)return r[0];throw Error("Sign in failed, no sign in result returned by wallet")}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}finally{em(this,Q,!1,"f")}}))})}signMessage(t){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){let e=eg(this,Z,"m",to).call(this);try{return(yield eg(this,G,"f").features[tW].signMessage({account:e,message:t}))[0].signature}catch(t){throw new tT.K3(null==t?void 0:t.message,t)}}))})}sendTransaction(t,e,r){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){let i=eg(this,Z,"m",to).call(this);try{if(tz in eg(this,G,"f").features){let e=eb(eg(this,G,"f").currentAuthorization.chain),[n]=(yield eg(this,G,"f").features[tz].signAndSendTransaction({account:i,transaction:t.serialize(),chain:e,options:r?{skipPreflight:r.skipPreflight,maxRetries:r.maxRetries}:void 0})).map(t=>ew(t.signature));return n}{let[i]=yield eg(this,Z,"m",ta).call(this,[t]);if("version"in i)return yield e.sendTransaction(i);{let t=i.serialize();return yield e.sendRawTransaction(t,Object.assign(Object.assign({},r),{preflightCommitment:function(){let t,i;switch(e.commitment){case"confirmed":case"finalized":case"processed":t=e.commitment;break;default:t="finalized"}switch(null==r?void 0:r.preflightCommitment){case"confirmed":case"finalized":case"processed":i=r.preflightCommitment;break;case void 0:i=t;break;default:i="finalized"}let n="finalized"===i?2:+("confirmed"===i),s="finalized"===t?2:+("confirmed"===t);return n<s?i:t}()}))}}}catch(t){throw new tT.UF(null==t?void 0:t.message,t)}}))})}signTransaction(t){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){let[e]=yield eg(this,Z,"m",ta).call(this,[t]);return e}))})}signAllTransactions(t){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",ta).call(this,t)}))})}}G=new WeakMap,Q=new WeakMap,X=new WeakMap,tt=new WeakMap,te=new WeakMap,tr=new WeakMap,ti=new WeakMap,Z=new WeakSet,tn=function(t=!1){return ep(this,void 0,void 0,function*(){if(!this.connecting&&!this.connected)return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){if(eg(this,X,"f")!==tB.Ok.Installed&&eg(this,X,"f")!==tB.Ok.Loadable)throw new tT.AE;em(this,Q,!0,"f");try{yield eg(this,G,"f").features[ey].connect({silent:t})}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}finally{em(this,Q,!1,"f")}}))})},ts=function(){eg(this,X,"f")!==tB.Ok.Installed&&this.emit("readyStateChange",em(this,X,tB.Ok.Installed,"f"))},to=function(){if(!eg(this,G,"f").isAuthorized||!eg(this,te,"f"))throw new tT.kW;return eg(this,te,"f")},ta=function(t){return ep(this,void 0,void 0,function*(){let e=eg(this,Z,"m",to).call(this);try{if(tN in eg(this,G,"f").features)return eg(this,G,"f").features[tN].signTransaction(...t.map(t=>({account:e,transaction:t.serialize()}))).then(t=>t.map(t=>{let e=t.signedTransaction,r=e[0],i=tU.B2.deserializeMessageVersion(e.slice(64*r+1,e.length));return"legacy"===i?tU.ZX.from(e):tU.Kt.deserialize(e)}));throw Error("Connected wallet does not support signing transactions")}catch(t){throw new tT.z4(null==t?void 0:t.message,t)}})},tu=function(t){return ep(this,void 0,void 0,function*(){try{return yield t()}catch(t){throw this.emit("error",t),t}})};class ek extends ev{constructor(t){var e;const r=eb(null!=(e=t.chain)?e:t.cluster);super(new el({appIdentity:t.appIdentity,authorizationCache:{set:t.authorizationResultCache.set,get:()=>ep(this,void 0,void 0,function*(){return yield t.authorizationResultCache.get()}),clear:t.authorizationResultCache.clear},chains:[r],chainSelector:{select(t){return t9(this,void 0,void 0,function*(){return 1===t.length?t[0]:t.includes(t4.CE)?t4.CE:t[0]})}},onWalletNotFound:()=>ep(this,void 0,void 0,function*(){t.onWalletNotFound(this)})}),{addressSelector:t.addressSelector,chain:r})}}class eS extends ek{}function eE(t){return ep(this,void 0,void 0,function*(){return function(){return t9(this,void 0,void 0,function*(){if("undefined"!=typeof window){let t=window.navigator.userAgent.toLowerCase(),e=new ec;t.includes("wv")?e.initWithError({name:"SolanaMobileWalletAdapterError",code:"ERROR_BROWSER_NOT_SUPPORTED",message:""}):e.initWithError({name:"SolanaMobileWalletAdapterError",code:"ERROR_WALLET_NOT_FOUND",message:""}),e.open()}})}()})}let eM=function(t){return t6 in t.features&&t8 in t.features&&(tz in t.features||tN in t.features)};var eA=r(6137);function eI(t){switch(t){case"processed":case"confirmed":case"finalized":case void 0:return t;case"recent":return"processed";case"single":case"singleGossip":return"confirmed";case"max":case"root":return"finalized";default:return}}new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;var ex=function(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},e_=function(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r};class eB extends tB.Ce{get name(){return ex(this,tm,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return ex(this,tm,"f").icon}get readyState(){return ex(this,ty,"f")}get publicKey(){return ex(this,th,"f")}get connecting(){return ex(this,tf,"f")}get supportedTransactionVersions(){return ex(this,tg,"f")}get wallet(){return ex(this,tm,"f")}get standard(){return!0}constructor({wallet:t}){super(),tl.add(this),tc.set(this,void 0),th.set(this,void 0),tf.set(this,void 0),td.set(this,void 0),tp.set(this,void 0),tg.set(this,void 0),tm.set(this,void 0),ty.set(this,"undefined"==typeof window||"undefined"==typeof document?tB.Ok.Unsupported:tB.Ok.Installed),tS.set(this,t=>{if("accounts"in t){let t=ex(this,tm,"f").accounts[0];ex(this,tc,"f")&&!ex(this,td,"f")&&t!==ex(this,tc,"f")&&(t?ex(this,tl,"m",tb).call(this,t):(this.emit("error",new tT.PQ),ex(this,tl,"m",tv).call(this)))}"features"in t&&ex(this,tl,"m",tk).call(this)}),e_(this,tm,t,"f"),e_(this,tc,null,"f"),e_(this,th,null,"f"),e_(this,tf,!1,"f"),e_(this,td,!1,"f"),e_(this,tp,ex(this,tm,"f").features[t8].on("change",ex(this,tS,"f")),"f"),ex(this,tl,"m",tk).call(this)}destroy(){e_(this,tc,null,"f"),e_(this,th,null,"f"),e_(this,tf,!1,"f"),e_(this,td,!1,"f");let t=ex(this,tp,"f");t&&(e_(this,tp,null,"f"),t())}async autoConnect(){return ex(this,tl,"m",tw).call(this,{silent:!0})}async connect(){return ex(this,tl,"m",tw).call(this)}async disconnect(){if(t3 in ex(this,tm,"f").features)try{e_(this,td,!0,"f"),await ex(this,tm,"f").features[t3].disconnect()}catch(t){this.emit("error",new tT.Y8(t?.message,t))}finally{e_(this,td,!1,"f")}ex(this,tl,"m",tv).call(this)}async sendTransaction(t,e,r={}){try{let i,n=ex(this,tc,"f");if(!n)throw new tT.kW;if(tz in ex(this,tm,"f").features)if(n.features.includes(tz))i=tz;else if(tN in ex(this,tm,"f").features&&n.features.includes(tN))i=tN;else throw new tT.fk;else if(tN in ex(this,tm,"f").features){if(!n.features.includes(tN))throw new tT.fk;i=tN}else throw new tT.Ez;let s=(0,eA.GZ)(e.rpcEndpoint);if(!n.chains.includes(s))throw new tT.UF;try{let o,{signers:a,...u}=r;if(tC(t)?(a?.length&&t.sign(a),o=t.serialize()):(t=await this.prepareTransaction(t,e,u),a?.length&&t.partialSign(...a),o=new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))),i===tz){let[t]=await ex(this,tm,"f").features[tz].signAndSendTransaction({account:n,chain:s,transaction:o,options:{preflightCommitment:eI(u.preflightCommitment||e.commitment),skipPreflight:u.skipPreflight,maxRetries:u.maxRetries,minContextSlot:u.minContextSlot}});return t5.encode(t.signature)}{let[t]=await ex(this,tm,"f").features[tN].signTransaction({account:n,chain:s,transaction:o,options:{preflightCommitment:eI(u.preflightCommitment||e.commitment),minContextSlot:u.minContextSlot}});return await e.sendRawTransaction(t.signedTransaction,{...u,preflightCommitment:eI(u.preflightCommitment||e.commitment)})}}catch(t){if(t instanceof tT.m7)throw t;throw new tT.UF(t?.message,t)}}catch(t){throw this.emit("error",t),t}}}tc=new WeakMap,th=new WeakMap,tf=new WeakMap,td=new WeakMap,tp=new WeakMap,tg=new WeakMap,tm=new WeakMap,ty=new WeakMap,tS=new WeakMap,tl=new WeakSet,tw=async function(t){try{if(this.connected||this.connecting)return;if(ex(this,ty,"f")!==tB.Ok.Installed)throw new tT.AE;if(e_(this,tf,!0,"f"),!ex(this,tm,"f").accounts.length)try{await ex(this,tm,"f").features[t6].connect(t)}catch(t){throw new tT.Y6(t?.message,t)}let e=ex(this,tm,"f").accounts[0];if(!e)throw new tT.fk;ex(this,tl,"m",tb).call(this,e)}catch(t){throw this.emit("error",t),t}finally{e_(this,tf,!1,"f")}},tb=function(t){let e;try{e=new tU.J3(t.address)}catch(t){throw new tT.Kd(t?.message,t)}e_(this,tc,t,"f"),e_(this,th,e,"f"),ex(this,tl,"m",tk).call(this),this.emit("connect",e)},tv=function(){e_(this,tc,null,"f"),e_(this,th,null,"f"),ex(this,tl,"m",tk).call(this),this.emit("disconnect")},tk=function(){let t=tz in ex(this,tm,"f").features?ex(this,tm,"f").features[tz].supportedTransactionVersions:ex(this,tm,"f").features[tN].supportedTransactionVersions;e_(this,tg,!function(t,e){if(t===e)return!0;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}(t,["legacy"])?new Set(t):null,"f"),tN in ex(this,tm,"f").features&&ex(this,tc,"f")?.features.includes(tN)?(this.signTransaction=ex(this,tl,"m",tE),this.signAllTransactions=ex(this,tl,"m",tM)):(delete this.signTransaction,delete this.signAllTransactions),tW in ex(this,tm,"f").features&&ex(this,tc,"f")?.features.includes(tW)?this.signMessage=ex(this,tl,"m",tA):delete this.signMessage,tO in ex(this,tm,"f").features?this.signIn=ex(this,tl,"m",tI):delete this.signIn},tE=async function(t){try{let e=ex(this,tc,"f");if(!e)throw new tT.kW;if(!(tN in ex(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tN))throw new tT.fk;try{let r=(await ex(this,tm,"f").features[tN].signTransaction({account:e,transaction:tC(t)?t.serialize():new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))[0].signedTransaction;return tC(t)?tU.Kt.deserialize(r):tU.ZX.from(r)}catch(t){if(t instanceof tT.m7)throw t;throw new tT.z4(t?.message,t)}}catch(t){throw this.emit("error",t),t}},tM=async function(t){try{let e=ex(this,tc,"f");if(!e)throw new tT.kW;if(!(tN in ex(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tN))throw new tT.fk;try{let r=await ex(this,tm,"f").features[tN].signTransaction(...t.map(t=>({account:e,transaction:tC(t)?t.serialize():new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))})));return t.map((t,e)=>{let i=r[e].signedTransaction;return tC(t)?tU.Kt.deserialize(i):tU.ZX.from(i)})}catch(t){throw new tT.z4(t?.message,t)}}catch(t){throw this.emit("error",t),t}},tA=async function(t){try{let e=ex(this,tc,"f");if(!e)throw new tT.kW;if(!(tW in ex(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tW))throw new tT.fk;try{return(await ex(this,tm,"f").features[tW].signMessage({account:e,message:t}))[0].signature}catch(t){throw new tT.K3(t?.message,t)}}catch(t){throw this.emit("error",t),t}},tI=async function(t={}){try{let e;if(!(tO in ex(this,tm,"f").features))throw new tT.Ez;try{[e]=await ex(this,tm,"f").features[tO].signIn(t)}catch(t){throw new tT.o7(t?.message,t)}if(!e)throw new tT.o7;return ex(this,tl,"m",tb).call(this,e.account),e}catch(t){throw this.emit("error",t),t}};var eT=function(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},eC=function(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r};let eR=new Set,eP={};function eL(...t){return(t=t.filter(t=>!eR.has(t))).length?(t.forEach(t=>{n=void 0,eR.add(t)}),eP.register?.forEach(e=>eW(()=>e(...t))),function(){t.forEach(t=>{n=void 0,eR.delete(t)}),eP.unregister?.forEach(e=>eW(()=>e(...t)))}):()=>{}}function eU(){return n||(n=[...eR]),n}function eO(t,e){return eP[t]?.push(e)||(eP[t]=[e]),function(){eP[t]=eP[t]?.filter(t=>e!==t)}}function eW(t){try{t()}catch(t){console.error(t)}}class ez extends Event{get detail(){return eT(this,tx,"f")}get type(){return"wallet-standard:app-ready"}constructor(t){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),tx.set(this,void 0),eC(this,tx,t,"f")}preventDefault(){throw Error("preventDefault cannot be called")}stopImmediatePropagation(){throw Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw Error("stopPropagation cannot be called")}}tx=new WeakMap;var eN=r(5074);function ej(t){let e=(0,eN.useRef)(void 0);return void 0===e.current&&(e.current={value:t()}),e.current.value}function eK(t){return t.filter(eM).map(t=>new eB({wallet:t}))}(a=t_||(t_={}))[a.DESKTOP_WEB=0]="DESKTOP_WEB",a[a.MOBILE_WEB=1]="MOBILE_WEB";var eq=r(871);class eD extends tT.m7{constructor(){super(...arguments),this.name="WalletNotSelectedError"}}var e$=r(5334);function eF({children:t,wallets:e,adapter:r,isUnloadingRef:i,onAutoConnectRequest:n,onConnectError:s,onError:o,onSelectWallet:a}){let u=(0,eN.useRef)(!1),[l,c]=(0,eN.useState)(!1),h=(0,eN.useRef)(!1),[f,d]=(0,eN.useState)(!1),[p,g]=(0,eN.useState)(()=>r?.publicKey??null),[m,y]=(0,eN.useState)(()=>r?.connected??!1),w=(0,eN.useRef)(o);(0,eN.useEffect)(()=>(w.current=o,()=>{w.current=void 0}),[o]);let b=(0,eN.useRef)((t,e)=>(!i.current&&(w.current?w.current(t,e):(console.error(t,e),t instanceof tT.AE&&"undefined"!=typeof window&&e&&window.open(e.url,"_blank"))),t)),[v,k]=(0,eN.useState)(()=>e.map(t=>({adapter:t,readyState:t.readyState})).filter(({readyState:t})=>t!==tB.Ok.Unsupported));(0,eN.useEffect)(()=>{function t(t){k(e=>{let r=e.findIndex(({adapter:t})=>t===this);if(-1===r)return e;let{adapter:i}=e[r];return[...e.slice(0,r),{adapter:i,readyState:t},...e.slice(r+1)].filter(({readyState:t})=>t!==tB.Ok.Unsupported)})}return k(t=>e.map((e,r)=>{let i=t[r];return i&&i.adapter===e&&i.readyState===e.readyState?i:{adapter:e,readyState:e.readyState}}).filter(({readyState:t})=>t!==tB.Ok.Unsupported)),e.forEach(e=>e.on("readyStateChange",t,e)),()=>{e.forEach(e=>e.off("readyStateChange",t,e))}},[r,e]);let S=(0,eN.useMemo)(()=>v.find(t=>t.adapter===r)??null,[r,v]);(0,eN.useEffect)(()=>{if(!r)return;let t=t=>{g(t),u.current=!1,c(!1),y(!0),h.current=!1,d(!1)},e=()=>{i.current||(g(null),u.current=!1,c(!1),y(!1),h.current=!1,d(!1))},n=t=>{b.current(t,r)};return r.on("connect",t),r.on("disconnect",e),r.on("error",n),()=>{r.off("connect",t),r.off("disconnect",e),r.off("error",n),e()}},[r,i]);let E=(0,eN.useRef)(!1);(0,eN.useEffect)(()=>()=>{E.current=!1},[r]),(0,eN.useEffect)(()=>{E.current||u.current||m||!n||S?.readyState!==tB.Ok.Installed&&S?.readyState!==tB.Ok.Loadable||(u.current=!0,c(!0),E.current=!0,async function(){try{await n()}catch{s()}finally{c(!1),u.current=!1}}())},[m,n,s,S]);let M=(0,eN.useCallback)(async(t,e,i)=>{if(!r)throw b.current(new eD);if(!m)throw b.current(new tT.kW,r);return await r.sendTransaction(t,e,i)},[r,m]),A=(0,eN.useMemo)(()=>r&&"signTransaction"in r?async t=>{if(!m)throw b.current(new tT.kW,r);return await r.signTransaction(t)}:void 0,[r,m]),I=(0,eN.useMemo)(()=>r&&"signAllTransactions"in r?async t=>{if(!m)throw b.current(new tT.kW,r);return await r.signAllTransactions(t)}:void 0,[r,m]),x=(0,eN.useMemo)(()=>r&&"signMessage"in r?async t=>{if(!m)throw b.current(new tT.kW,r);return await r.signMessage(t)}:void 0,[r,m]),_=(0,eN.useMemo)(()=>r&&"signIn"in r?async t=>await r.signIn(t):void 0,[r]),B=(0,eN.useCallback)(async()=>{if(u.current||h.current||S?.adapter.connected)return;if(!S)throw b.current(new eD);let{adapter:t,readyState:e}=S;if(e!==tB.Ok.Installed&&e!==tB.Ok.Loadable)throw b.current(new tT.AE,t);u.current=!0,c(!0);try{await t.connect()}catch(t){throw s(),t}finally{c(!1),u.current=!1}},[s,S]),T=(0,eN.useCallback)(async()=>{if(!h.current&&r){h.current=!0,d(!0);try{await r.disconnect()}finally{d(!1),h.current=!1}}},[r]);return eN.createElement(e$.b.Provider,{value:{autoConnect:!!n,wallets:v,wallet:S,publicKey:p,connected:m,connecting:l,disconnecting:f,select:a,connect:B,disconnect:T,sendTransaction:M,signTransaction:A,signAllTransactions:I,signMessage:x,signIn:_}},t)}function eH(t){return function({adapters:t,userAgentString:e}){return t.some(t=>t.name!==ea&&t.readyState===tB.Ok.Installed)?t_.DESKTOP_WEB:e&&/android/i.test(e)&&!/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(e)?t_.MOBILE_WEB:t_.DESKTOP_WEB}({adapters:t,userAgentString:(void 0===s&&(s=globalThis.navigator?.userAgent??null),s)})===t_.MOBILE_WEB}function eV({children:t,wallets:e,autoConnect:r,localStorageKey:i="walletName",onError:n}){let s,a,u,{connection:l}=(0,eq.w)(),c=function(t){var e;let r,i=ej(()=>new Set),{get:n,on:s}=ej(()=>(function(){if(o||(o=function(){if(o||(o=Object.freeze({register:eL,get:eU,on:eO}),"undefined"==typeof window))return o;let t=Object.freeze({register:eL});try{window.addEventListener("wallet-standard:register-wallet",({detail:e})=>e(t))}catch(t){console.error("wallet-standard:register-wallet event listener could not be added\n",t)}try{window.dispatchEvent(new ez(t))}catch(t){console.error("wallet-standard:app-ready event could not be dispatched\n",t)}return o}(),"undefined"==typeof window))return o;let t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),o;let{register:e}=o,r=(...t)=>t.forEach(t=>eW(()=>t({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:r})})}catch(t){return console.error("window.navigator.wallets could not be set"),o}return r(...t),o})()),[a,u]=(0,eN.useState)(()=>eK(n()));(0,eN.useEffect)(()=>{let t=[s("register",(...t)=>u(e=>[...e,...eK(t)])),s("unregister",(...t)=>u(e=>e.filter(e=>t.some(t=>t===e.wallet))))];return()=>t.forEach(t=>t())},[s]);let l=(e=a,r=(0,eN.useRef)(void 0),(0,eN.useEffect)(()=>{r.current=e}),r.current);return(0,eN.useEffect)(()=>{if(!l)return;let t=new Set(a);new Set(l.filter(e=>!t.has(e))).forEach(t=>t.destroy())},[l,a]),(0,eN.useEffect)(()=>()=>a.forEach(t=>t.destroy()),[]),(0,eN.useMemo)(()=>[...a,...t.filter(({name:t})=>!a.some(e=>e.name===t)||(i.has(t)||(i.add(t),console.warn(`${t} was registered as a Standard Wallet. The Wallet Adapter for ${t} can be removed from your app.`)),!1))],[a,t,i])}(e),h=(0,eN.useMemo)(()=>{var t;if(!eH(c))return null;let e=c.find(t=>t.name===ea);return e?e:new eS({addressSelector:{select(t){return ep(this,void 0,void 0,function*(){return t[0]})}},appIdentity:{uri:function(){let t=globalThis.location;if(t)return`${t.protocol}//${t.host}`}()},authorizationResultCache:function(){let t;try{t=window.localStorage}catch(t){}return{clear(){return t9(this,void 0,void 0,function*(){if(t)try{t.removeItem(ed)}catch(t){}})},get(){return t9(this,void 0,void 0,function*(){if(t)try{let e=JSON.parse(t.getItem(ed));if(!e||!e.accounts)return e||void 0;{let t=e.accounts.map(t=>Object.assign(Object.assign({},t),{publicKey:"publicKey"in t?new Uint8Array(Object.values(t.publicKey)):t5.decode(t.address)}));return Object.assign(Object.assign({},e),{accounts:t})}}catch(t){}})},set(e){return t9(this,void 0,void 0,function*(){if(t)try{t.setItem(ed,JSON.stringify(e))}catch(t){}})}}}(),cluster:(t=l?.rpcEndpoint)?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta",onWalletNotFound:eE})},[c,l?.rpcEndpoint]),f=(0,eN.useMemo)(()=>null==h||-1!==c.indexOf(h)?c:[h,...c],[c,h]),[d,p]=(a=(s=(0,eN.useState)(()=>{try{let t=localStorage.getItem(i);if(t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&console.error(t)}return null}))[0],u=(0,eN.useRef)(!0),(0,eN.useEffect)(()=>{if(u.current){u.current=!1;return}try{null===a?localStorage.removeItem(i):localStorage.setItem(i,JSON.stringify(a))}catch(t){"undefined"!=typeof window&&console.error(t)}},[a,i]),s),g=(0,eN.useMemo)(()=>f.find(t=>t.name===d)??null,[f,d]),m=(0,eN.useCallback)(t=>{d!==t&&(g&&g.name!==ea&&g.disconnect(),p(t))},[g,p,d]);(0,eN.useEffect)(()=>{if(g)return g.on("disconnect",t),()=>{g.off("disconnect",t)};function t(){b.current||p(null)}},[g,c,p,d]);let y=(0,eN.useRef)(!1),w=(0,eN.useMemo)(()=>{if(r&&g)return async()=>{(!0===r||await r(g))&&(y.current?await g.connect():await g.autoConnect())}},[r,g]),b=(0,eN.useRef)(!1);(0,eN.useEffect)(()=>{if(d===ea&&eH(c)){b.current=!1;return}function t(){b.current=!0}return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[c,d]);let v=(0,eN.useCallback)(()=>{g&&m(null)},[g,m]),k=(0,eN.useCallback)(t=>{y.current=!0,m(t)},[m]);return eN.createElement(eF,{wallets:f,adapter:g,isUnloadingRef:b,onAutoConnectRequest:w,onConnectError:v,onError:n,onSelectWallet:k},t)}},871:function(t,e,r){"use strict";r.d(e,{E:()=>n,w:()=>s});var i=r(5074);let n=(0,i.createContext)({});function s(){return(0,i.useContext)(n)}},5334:function(t,e,r){"use strict";r.d(e,{b:()=>a,v:()=>u});var i=r(5074);let n=[],s={autoConnect:!1,connecting:!1,connected:!1,disconnecting:!1,select(){o("call","select")},connect:()=>Promise.reject(o("call","connect")),disconnect:()=>Promise.reject(o("call","disconnect")),sendTransaction:()=>Promise.reject(o("call","sendTransaction")),signTransaction:()=>Promise.reject(o("call","signTransaction")),signAllTransactions:()=>Promise.reject(o("call","signAllTransactions")),signMessage:()=>Promise.reject(o("call","signMessage")),signIn:()=>Promise.reject(o("call","signIn"))};function o(t,e){let r=Error(`You have tried to ${t} "${e}" on a WalletContext without providing one. Make sure to render a WalletProvider as an ancestor of the component that uses WalletContext.`);return console.error(r),r}Object.defineProperty(s,"wallets",{get:()=>(o("read","wallets"),n)}),Object.defineProperty(s,"wallet",{get:()=>(o("read","wallet"),null)}),Object.defineProperty(s,"publicKey",{get:()=>(o("read","publicKey"),null)});let a=(0,i.createContext)(s);function u(){return(0,i.useContext)(a)}},1899:function(t,e,r){"use strict";r.d(e,{CE:()=>i,g4:()=>o,re:()=>s,sE:()=>n});let i="solana:mainnet",n="solana:devnet",s="solana:testnet",o="solana:localnet"},6137:function(t,e,r){"use strict";r.d(e,{GZ:()=>s,RU:()=>n});var i=r(1899);let n="https://api.mainnet-beta.solana.com";function s(t){return t.includes(n)?i.CE:/\bdevnet\b/i.test(t)?i.sE:/\btestnet\b/i.test(t)?i.re:/\blocalhost\b/i.test(t)||/\b127\.0\.0\.1\b/.test(t)?i.g4:i.CE}}}]);
|
|
143
|
+
`,ed="SolanaMobileWalletAdapterDefaultAuthorizationCache";function ep(t,e,r,i){return new(r||(r=Promise))(function(n,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?n(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(o,a)}u((i=i.apply(t,e||[])).next())})}function eg(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)}function em(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r}let ey="standard:connect";function ew(t){return window.btoa(String.fromCharCode.call(null,...t))}function eb(t){switch(t){case"mainnet-beta":return"solana:mainnet";case"testnet":return"solana:testnet";case"devnet":return"solana:devnet";default:return t}}class ev extends tL{constructor(t,e){super(),Z.add(this),this.supportedTransactionVersions=new Set(["legacy",0]),G.set(this,void 0),Q.set(this,!1),X.set(this,"undefined"!=typeof window&&window.isSecureContext&&"undefined"!=typeof document&&/android/i.test(navigator.userAgent)?tB.Ok.Loadable:tB.Ok.Unsupported),tt.set(this,void 0),te.set(this,void 0),tr.set(this,void 0),ti.set(this,t=>ep(this,void 0,void 0,function*(){if(t.accounts&&t.accounts.length>0){eg(this,Z,"m",ts).call(this);let e=yield eg(this,tt,"f").call(this,t.accounts);e!==eg(this,te,"f")&&(em(this,te,e,"f"),em(this,tr,void 0,"f"),this.emit("connect",this.publicKey))}})),em(this,tt,t=>ep(this,void 0,void 0,function*(){var r;let i=yield e.addressSelector.select(t.map(({publicKey:t})=>ew(t)));return null!=(r=t.find(({publicKey:t})=>ew(t)===i))?r:t[0]}),"f"),em(this,G,t,"f"),eg(this,G,"f").features["standard:events"].on("change",eg(this,ti,"f")),this.name=eg(this,G,"f").name,this.icon=eg(this,G,"f").icon,this.url=eg(this,G,"f").url}get publicKey(){var t;if(!eg(this,tr,"f")&&eg(this,te,"f"))try{em(this,tr,new tU.J3(eg(this,te,"f").publicKey),"f")}catch(t){throw new tT.Kd(t instanceof Error&&(null==t?void 0:t.message)||"Unknown error",t)}return null!=(t=eg(this,tr,"f"))?t:null}get connected(){return eg(this,G,"f").connected}get connecting(){return eg(this,Q,"f")}get readyState(){return eg(this,X,"f")}autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(){return ep(this,void 0,void 0,function*(){return yield this.autoConnect()})}autoConnect(){return ep(this,void 0,void 0,function*(){eg(this,Z,"m",tn).call(this,!0)})}connect(){return ep(this,void 0,void 0,function*(){eg(this,Z,"m",tn).call(this)})}performAuthorization(t){return ep(this,void 0,void 0,function*(){try{let e=yield eg(this,G,"f").cachedAuthorizationResult;if(e)return yield eg(this,G,"f").features[ey].connect({silent:!0}),e;return t?yield eg(this,G,"f").features[tO].signIn(t):yield eg(this,G,"f").features[ey].connect(),yield yield eg(this,G,"f").cachedAuthorizationResult}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}})}disconnect(){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){em(this,Q,!1,"f"),em(this,tr,void 0,"f"),em(this,te,void 0,"f"),yield eg(this,G,"f").features["standard:disconnect"].disconnect(),this.emit("disconnect")}))})}signIn(t){return ep(this,void 0,void 0,function*(){return eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){var e;if(eg(this,X,"f")!==tB.Ok.Installed&&eg(this,X,"f")!==tB.Ok.Loadable)throw new tT.AE;em(this,Q,!0,"f");try{let r=yield eg(this,G,"f").features[tO].signIn(Object.assign(Object.assign({},t),{domain:null!=(e=null==t?void 0:t.domain)?e:window.location.host}));if(r.length>0)return r[0];throw Error("Sign in failed, no sign in result returned by wallet")}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}finally{em(this,Q,!1,"f")}}))})}signMessage(t){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){let e=eg(this,Z,"m",to).call(this);try{return(yield eg(this,G,"f").features[tW].signMessage({account:e,message:t}))[0].signature}catch(t){throw new tT.K3(null==t?void 0:t.message,t)}}))})}sendTransaction(t,e,r){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){let i=eg(this,Z,"m",to).call(this);try{if(tz in eg(this,G,"f").features){let e=eb(eg(this,G,"f").currentAuthorization.chain),[n]=(yield eg(this,G,"f").features[tz].signAndSendTransaction({account:i,transaction:t.serialize(),chain:e,options:r?{skipPreflight:r.skipPreflight,maxRetries:r.maxRetries}:void 0})).map(t=>ew(t.signature));return n}{let[i]=yield eg(this,Z,"m",ta).call(this,[t]);if("version"in i)return yield e.sendTransaction(i);{let t=i.serialize();return yield e.sendRawTransaction(t,Object.assign(Object.assign({},r),{preflightCommitment:function(){let t,i;switch(e.commitment){case"confirmed":case"finalized":case"processed":t=e.commitment;break;default:t="finalized"}switch(null==r?void 0:r.preflightCommitment){case"confirmed":case"finalized":case"processed":i=r.preflightCommitment;break;case void 0:i=t;break;default:i="finalized"}let n="finalized"===i?2:+("confirmed"===i),s="finalized"===t?2:+("confirmed"===t);return n<s?i:t}()}))}}}catch(t){throw new tT.UF(null==t?void 0:t.message,t)}}))})}signTransaction(t){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){let[e]=yield eg(this,Z,"m",ta).call(this,[t]);return e}))})}signAllTransactions(t){return ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){return yield eg(this,Z,"m",ta).call(this,t)}))})}}G=new WeakMap,Q=new WeakMap,X=new WeakMap,tt=new WeakMap,te=new WeakMap,tr=new WeakMap,ti=new WeakMap,Z=new WeakSet,tn=function(t=!1){return ep(this,void 0,void 0,function*(){if(!this.connecting&&!this.connected)return yield eg(this,Z,"m",tu).call(this,()=>ep(this,void 0,void 0,function*(){if(eg(this,X,"f")!==tB.Ok.Installed&&eg(this,X,"f")!==tB.Ok.Loadable)throw new tT.AE;em(this,Q,!0,"f");try{yield eg(this,G,"f").features[ey].connect({silent:t})}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}finally{em(this,Q,!1,"f")}}))})},ts=function(){eg(this,X,"f")!==tB.Ok.Installed&&this.emit("readyStateChange",em(this,X,tB.Ok.Installed,"f"))},to=function(){if(!eg(this,G,"f").isAuthorized||!eg(this,te,"f"))throw new tT.kW;return eg(this,te,"f")},ta=function(t){return ep(this,void 0,void 0,function*(){let e=eg(this,Z,"m",to).call(this);try{if(tN in eg(this,G,"f").features)return eg(this,G,"f").features[tN].signTransaction(...t.map(t=>({account:e,transaction:t.serialize()}))).then(t=>t.map(t=>{let e=t.signedTransaction,r=e[0],i=tU.B2.deserializeMessageVersion(e.slice(64*r+1,e.length));return"legacy"===i?tU.ZX.from(e):tU.Kt.deserialize(e)}));throw Error("Connected wallet does not support signing transactions")}catch(t){throw new tT.z4(null==t?void 0:t.message,t)}})},tu=function(t){return ep(this,void 0,void 0,function*(){try{return yield t()}catch(t){throw this.emit("error",t),t}})};class ek extends ev{constructor(t){var e;const r=eb(null!=(e=t.chain)?e:t.cluster);super(new el({appIdentity:t.appIdentity,authorizationCache:{set:t.authorizationResultCache.set,get:()=>ep(this,void 0,void 0,function*(){return yield t.authorizationResultCache.get()}),clear:t.authorizationResultCache.clear},chains:[r],chainSelector:{select(t){return t9(this,void 0,void 0,function*(){return 1===t.length?t[0]:t.includes(t4.CE)?t4.CE:t[0]})}},onWalletNotFound:()=>ep(this,void 0,void 0,function*(){t.onWalletNotFound(this)})}),{addressSelector:t.addressSelector,chain:r})}}class eS extends ek{}function eE(t){return ep(this,void 0,void 0,function*(){return function(){return t9(this,void 0,void 0,function*(){if("undefined"!=typeof window){let t=window.navigator.userAgent.toLowerCase(),e=new ec;t.includes("wv")?e.initWithError({name:"SolanaMobileWalletAdapterError",code:"ERROR_BROWSER_NOT_SUPPORTED",message:""}):e.initWithError({name:"SolanaMobileWalletAdapterError",code:"ERROR_WALLET_NOT_FOUND",message:""}),e.open()}})}()})}let eM=function(t){return t6 in t.features&&t8 in t.features&&(tz in t.features||tN in t.features)};var eA=r(6137);function eI(t){switch(t){case"processed":case"confirmed":case"finalized":case void 0:return t;case"recent":return"processed";case"single":case"singleGossip":return"confirmed";case"max":case"root":return"finalized";default:return}}new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;let ex=(0,r(9086).A)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var e_=function(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},eB=function(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r};class eT extends tB.Ce{get name(){return e_(this,tm,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return e_(this,tm,"f").icon}get readyState(){return e_(this,ty,"f")}get publicKey(){return e_(this,th,"f")}get connecting(){return e_(this,tf,"f")}get supportedTransactionVersions(){return e_(this,tg,"f")}get wallet(){return e_(this,tm,"f")}get standard(){return!0}constructor({wallet:t}){super(),tl.add(this),tc.set(this,void 0),th.set(this,void 0),tf.set(this,void 0),td.set(this,void 0),tp.set(this,void 0),tg.set(this,void 0),tm.set(this,void 0),ty.set(this,"undefined"==typeof window||"undefined"==typeof document?tB.Ok.Unsupported:tB.Ok.Installed),tS.set(this,t=>{if("accounts"in t){let t=e_(this,tm,"f").accounts[0];e_(this,tc,"f")&&!e_(this,td,"f")&&t!==e_(this,tc,"f")&&(t?e_(this,tl,"m",tb).call(this,t):(this.emit("error",new tT.PQ),e_(this,tl,"m",tv).call(this)))}"features"in t&&e_(this,tl,"m",tk).call(this)}),eB(this,tm,t,"f"),eB(this,tc,null,"f"),eB(this,th,null,"f"),eB(this,tf,!1,"f"),eB(this,td,!1,"f"),eB(this,tp,e_(this,tm,"f").features[t8].on("change",e_(this,tS,"f")),"f"),e_(this,tl,"m",tk).call(this)}destroy(){eB(this,tc,null,"f"),eB(this,th,null,"f"),eB(this,tf,!1,"f"),eB(this,td,!1,"f");let t=e_(this,tp,"f");t&&(eB(this,tp,null,"f"),t())}async autoConnect(){return e_(this,tl,"m",tw).call(this,{silent:!0})}async connect(){return e_(this,tl,"m",tw).call(this)}async disconnect(){if(t3 in e_(this,tm,"f").features)try{eB(this,td,!0,"f"),await e_(this,tm,"f").features[t3].disconnect()}catch(t){this.emit("error",new tT.Y8(t?.message,t))}finally{eB(this,td,!1,"f")}e_(this,tl,"m",tv).call(this)}async sendTransaction(t,e,r={}){try{let i,n=e_(this,tc,"f");if(!n)throw new tT.kW;if(tz in e_(this,tm,"f").features)if(n.features.includes(tz))i=tz;else if(tN in e_(this,tm,"f").features&&n.features.includes(tN))i=tN;else throw new tT.fk;else if(tN in e_(this,tm,"f").features){if(!n.features.includes(tN))throw new tT.fk;i=tN}else throw new tT.Ez;let s=(0,eA.GZ)(e.rpcEndpoint);if(!n.chains.includes(s))throw new tT.UF;try{let o,{signers:a,...u}=r;if(tC(t)?(a?.length&&t.sign(a),o=t.serialize()):(t=await this.prepareTransaction(t,e,u),a?.length&&t.partialSign(...a),o=new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))),i===tz){let[t]=await e_(this,tm,"f").features[tz].signAndSendTransaction({account:n,chain:s,transaction:o,options:{preflightCommitment:eI(u.preflightCommitment||e.commitment),skipPreflight:u.skipPreflight,maxRetries:u.maxRetries,minContextSlot:u.minContextSlot}});return ex.encode(t.signature)}{let[t]=await e_(this,tm,"f").features[tN].signTransaction({account:n,chain:s,transaction:o,options:{preflightCommitment:eI(u.preflightCommitment||e.commitment),minContextSlot:u.minContextSlot}});return await e.sendRawTransaction(t.signedTransaction,{...u,preflightCommitment:eI(u.preflightCommitment||e.commitment)})}}catch(t){if(t instanceof tT.m7)throw t;throw new tT.UF(t?.message,t)}}catch(t){throw this.emit("error",t),t}}}tc=new WeakMap,th=new WeakMap,tf=new WeakMap,td=new WeakMap,tp=new WeakMap,tg=new WeakMap,tm=new WeakMap,ty=new WeakMap,tS=new WeakMap,tl=new WeakSet,tw=async function(t){try{if(this.connected||this.connecting)return;if(e_(this,ty,"f")!==tB.Ok.Installed)throw new tT.AE;if(eB(this,tf,!0,"f"),!e_(this,tm,"f").accounts.length)try{await e_(this,tm,"f").features[t6].connect(t)}catch(t){throw new tT.Y6(t?.message,t)}let e=e_(this,tm,"f").accounts[0];if(!e)throw new tT.fk;e_(this,tl,"m",tb).call(this,e)}catch(t){throw this.emit("error",t),t}finally{eB(this,tf,!1,"f")}},tb=function(t){let e;try{e=new tU.J3(t.address)}catch(t){throw new tT.Kd(t?.message,t)}eB(this,tc,t,"f"),eB(this,th,e,"f"),e_(this,tl,"m",tk).call(this),this.emit("connect",e)},tv=function(){eB(this,tc,null,"f"),eB(this,th,null,"f"),e_(this,tl,"m",tk).call(this),this.emit("disconnect")},tk=function(){let t=tz in e_(this,tm,"f").features?e_(this,tm,"f").features[tz].supportedTransactionVersions:e_(this,tm,"f").features[tN].supportedTransactionVersions;eB(this,tg,!function(t,e){if(t===e)return!0;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}(t,["legacy"])?new Set(t):null,"f"),tN in e_(this,tm,"f").features&&e_(this,tc,"f")?.features.includes(tN)?(this.signTransaction=e_(this,tl,"m",tE),this.signAllTransactions=e_(this,tl,"m",tM)):(delete this.signTransaction,delete this.signAllTransactions),tW in e_(this,tm,"f").features&&e_(this,tc,"f")?.features.includes(tW)?this.signMessage=e_(this,tl,"m",tA):delete this.signMessage,tO in e_(this,tm,"f").features?this.signIn=e_(this,tl,"m",tI):delete this.signIn},tE=async function(t){try{let e=e_(this,tc,"f");if(!e)throw new tT.kW;if(!(tN in e_(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tN))throw new tT.fk;try{let r=(await e_(this,tm,"f").features[tN].signTransaction({account:e,transaction:tC(t)?t.serialize():new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))[0].signedTransaction;return tC(t)?tU.Kt.deserialize(r):tU.ZX.from(r)}catch(t){if(t instanceof tT.m7)throw t;throw new tT.z4(t?.message,t)}}catch(t){throw this.emit("error",t),t}},tM=async function(t){try{let e=e_(this,tc,"f");if(!e)throw new tT.kW;if(!(tN in e_(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tN))throw new tT.fk;try{let r=await e_(this,tm,"f").features[tN].signTransaction(...t.map(t=>({account:e,transaction:tC(t)?t.serialize():new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))})));return t.map((t,e)=>{let i=r[e].signedTransaction;return tC(t)?tU.Kt.deserialize(i):tU.ZX.from(i)})}catch(t){throw new tT.z4(t?.message,t)}}catch(t){throw this.emit("error",t),t}},tA=async function(t){try{let e=e_(this,tc,"f");if(!e)throw new tT.kW;if(!(tW in e_(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tW))throw new tT.fk;try{return(await e_(this,tm,"f").features[tW].signMessage({account:e,message:t}))[0].signature}catch(t){throw new tT.K3(t?.message,t)}}catch(t){throw this.emit("error",t),t}},tI=async function(t={}){try{let e;if(!(tO in e_(this,tm,"f").features))throw new tT.Ez;try{[e]=await e_(this,tm,"f").features[tO].signIn(t)}catch(t){throw new tT.o7(t?.message,t)}if(!e)throw new tT.o7;return e_(this,tl,"m",tb).call(this,e.account),e}catch(t){throw this.emit("error",t),t}};var eC=function(t,e,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},eR=function(t,e,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r};let eP=new Set,eL={};function eU(...t){return(t=t.filter(t=>!eP.has(t))).length?(t.forEach(t=>{n=void 0,eP.add(t)}),eL.register?.forEach(e=>ez(()=>e(...t))),function(){t.forEach(t=>{n=void 0,eP.delete(t)}),eL.unregister?.forEach(e=>ez(()=>e(...t)))}):()=>{}}function eO(){return n||(n=[...eP]),n}function eW(t,e){return eL[t]?.push(e)||(eL[t]=[e]),function(){eL[t]=eL[t]?.filter(t=>e!==t)}}function ez(t){try{t()}catch(t){console.error(t)}}class eN extends Event{get detail(){return eC(this,tx,"f")}get type(){return"wallet-standard:app-ready"}constructor(t){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),tx.set(this,void 0),eR(this,tx,t,"f")}preventDefault(){throw Error("preventDefault cannot be called")}stopImmediatePropagation(){throw Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw Error("stopPropagation cannot be called")}}tx=new WeakMap;var ej=r(5074);function eK(t){let e=(0,ej.useRef)(void 0);return void 0===e.current&&(e.current={value:t()}),e.current.value}function eq(t){return t.filter(eM).map(t=>new eT({wallet:t}))}(a=t_||(t_={}))[a.DESKTOP_WEB=0]="DESKTOP_WEB",a[a.MOBILE_WEB=1]="MOBILE_WEB";var eD=r(3114);class e$ extends tT.m7{constructor(){super(...arguments),this.name="WalletNotSelectedError"}}var eF=r(3515);function eH({children:t,wallets:e,adapter:r,isUnloadingRef:i,onAutoConnectRequest:n,onConnectError:s,onError:o,onSelectWallet:a}){let u=(0,ej.useRef)(!1),[l,c]=(0,ej.useState)(!1),h=(0,ej.useRef)(!1),[f,d]=(0,ej.useState)(!1),[p,g]=(0,ej.useState)(()=>r?.publicKey??null),[m,y]=(0,ej.useState)(()=>r?.connected??!1),w=(0,ej.useRef)(o);(0,ej.useEffect)(()=>(w.current=o,()=>{w.current=void 0}),[o]);let b=(0,ej.useRef)((t,e)=>(!i.current&&(w.current?w.current(t,e):(console.error(t,e),t instanceof tT.AE&&"undefined"!=typeof window&&e&&window.open(e.url,"_blank"))),t)),[v,k]=(0,ej.useState)(()=>e.map(t=>({adapter:t,readyState:t.readyState})).filter(({readyState:t})=>t!==tB.Ok.Unsupported));(0,ej.useEffect)(()=>{function t(t){k(e=>{let r=e.findIndex(({adapter:t})=>t===this);if(-1===r)return e;let{adapter:i}=e[r];return[...e.slice(0,r),{adapter:i,readyState:t},...e.slice(r+1)].filter(({readyState:t})=>t!==tB.Ok.Unsupported)})}return k(t=>e.map((e,r)=>{let i=t[r];return i&&i.adapter===e&&i.readyState===e.readyState?i:{adapter:e,readyState:e.readyState}}).filter(({readyState:t})=>t!==tB.Ok.Unsupported)),e.forEach(e=>e.on("readyStateChange",t,e)),()=>{e.forEach(e=>e.off("readyStateChange",t,e))}},[r,e]);let S=(0,ej.useMemo)(()=>v.find(t=>t.adapter===r)??null,[r,v]);(0,ej.useEffect)(()=>{if(!r)return;let t=t=>{g(t),u.current=!1,c(!1),y(!0),h.current=!1,d(!1)},e=()=>{i.current||(g(null),u.current=!1,c(!1),y(!1),h.current=!1,d(!1))},n=t=>{b.current(t,r)};return r.on("connect",t),r.on("disconnect",e),r.on("error",n),()=>{r.off("connect",t),r.off("disconnect",e),r.off("error",n),e()}},[r,i]);let E=(0,ej.useRef)(!1);(0,ej.useEffect)(()=>()=>{E.current=!1},[r]),(0,ej.useEffect)(()=>{E.current||u.current||m||!n||S?.readyState!==tB.Ok.Installed&&S?.readyState!==tB.Ok.Loadable||(u.current=!0,c(!0),E.current=!0,async function(){try{await n()}catch{s()}finally{c(!1),u.current=!1}}())},[m,n,s,S]);let M=(0,ej.useCallback)(async(t,e,i)=>{if(!r)throw b.current(new e$);if(!m)throw b.current(new tT.kW,r);return await r.sendTransaction(t,e,i)},[r,m]),A=(0,ej.useMemo)(()=>r&&"signTransaction"in r?async t=>{if(!m)throw b.current(new tT.kW,r);return await r.signTransaction(t)}:void 0,[r,m]),I=(0,ej.useMemo)(()=>r&&"signAllTransactions"in r?async t=>{if(!m)throw b.current(new tT.kW,r);return await r.signAllTransactions(t)}:void 0,[r,m]),x=(0,ej.useMemo)(()=>r&&"signMessage"in r?async t=>{if(!m)throw b.current(new tT.kW,r);return await r.signMessage(t)}:void 0,[r,m]),_=(0,ej.useMemo)(()=>r&&"signIn"in r?async t=>await r.signIn(t):void 0,[r]),B=(0,ej.useCallback)(async()=>{if(u.current||h.current||S?.adapter.connected)return;if(!S)throw b.current(new e$);let{adapter:t,readyState:e}=S;if(e!==tB.Ok.Installed&&e!==tB.Ok.Loadable)throw b.current(new tT.AE,t);u.current=!0,c(!0);try{await t.connect()}catch(t){throw s(),t}finally{c(!1),u.current=!1}},[s,S]),T=(0,ej.useCallback)(async()=>{if(!h.current&&r){h.current=!0,d(!0);try{await r.disconnect()}finally{d(!1),h.current=!1}}},[r]);return ej.createElement(eF.b.Provider,{value:{autoConnect:!!n,wallets:v,wallet:S,publicKey:p,connected:m,connecting:l,disconnecting:f,select:a,connect:B,disconnect:T,sendTransaction:M,signTransaction:A,signAllTransactions:I,signMessage:x,signIn:_}},t)}function eV(t){return function({adapters:t,userAgentString:e}){return t.some(t=>t.name!==ea&&t.readyState===tB.Ok.Installed)?t_.DESKTOP_WEB:e&&/android/i.test(e)&&!/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(e)?t_.MOBILE_WEB:t_.DESKTOP_WEB}({adapters:t,userAgentString:(void 0===s&&(s=globalThis.navigator?.userAgent??null),s)})===t_.MOBILE_WEB}function eJ({children:t,wallets:e,autoConnect:r,localStorageKey:i="walletName",onError:n}){let s,a,u,{connection:l}=(0,eD.w)(),c=function(t){var e;let r,i=eK(()=>new Set),{get:n,on:s}=eK(()=>(function(){if(o||(o=function(){if(o||(o=Object.freeze({register:eU,get:eO,on:eW}),"undefined"==typeof window))return o;let t=Object.freeze({register:eU});try{window.addEventListener("wallet-standard:register-wallet",({detail:e})=>e(t))}catch(t){console.error("wallet-standard:register-wallet event listener could not be added\n",t)}try{window.dispatchEvent(new eN(t))}catch(t){console.error("wallet-standard:app-ready event could not be dispatched\n",t)}return o}(),"undefined"==typeof window))return o;let t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),o;let{register:e}=o,r=(...t)=>t.forEach(t=>ez(()=>t({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:r})})}catch(t){return console.error("window.navigator.wallets could not be set"),o}return r(...t),o})()),[a,u]=(0,ej.useState)(()=>eq(n()));(0,ej.useEffect)(()=>{let t=[s("register",(...t)=>u(e=>[...e,...eq(t)])),s("unregister",(...t)=>u(e=>e.filter(e=>t.some(t=>t===e.wallet))))];return()=>t.forEach(t=>t())},[s]);let l=(e=a,r=(0,ej.useRef)(void 0),(0,ej.useEffect)(()=>{r.current=e}),r.current);return(0,ej.useEffect)(()=>{if(!l)return;let t=new Set(a);new Set(l.filter(e=>!t.has(e))).forEach(t=>t.destroy())},[l,a]),(0,ej.useEffect)(()=>()=>a.forEach(t=>t.destroy()),[]),(0,ej.useMemo)(()=>[...a,...t.filter(({name:t})=>!a.some(e=>e.name===t)||(i.has(t)||(i.add(t),console.warn(`${t} was registered as a Standard Wallet. The Wallet Adapter for ${t} can be removed from your app.`)),!1))],[a,t,i])}(e),h=(0,ej.useMemo)(()=>{var t;if(!eV(c))return null;let e=c.find(t=>t.name===ea);return e?e:new eS({addressSelector:{select(t){return ep(this,void 0,void 0,function*(){return t[0]})}},appIdentity:{uri:function(){let t=globalThis.location;if(t)return`${t.protocol}//${t.host}`}()},authorizationResultCache:function(){let t;try{t=window.localStorage}catch(t){}return{clear(){return t9(this,void 0,void 0,function*(){if(t)try{t.removeItem(ed)}catch(t){}})},get(){return t9(this,void 0,void 0,function*(){if(t)try{let e=JSON.parse(t.getItem(ed));if(!e||!e.accounts)return e||void 0;{let t=e.accounts.map(t=>Object.assign(Object.assign({},t),{publicKey:"publicKey"in t?new Uint8Array(Object.values(t.publicKey)):t5.decode(t.address)}));return Object.assign(Object.assign({},e),{accounts:t})}}catch(t){}})},set(e){return t9(this,void 0,void 0,function*(){if(t)try{t.setItem(ed,JSON.stringify(e))}catch(t){}})}}}(),cluster:(t=l?.rpcEndpoint)?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta",onWalletNotFound:eE})},[c,l?.rpcEndpoint]),f=(0,ej.useMemo)(()=>null==h||-1!==c.indexOf(h)?c:[h,...c],[c,h]),[d,p]=(a=(s=(0,ej.useState)(()=>{try{let t=localStorage.getItem(i);if(t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&console.error(t)}return null}))[0],u=(0,ej.useRef)(!0),(0,ej.useEffect)(()=>{if(u.current){u.current=!1;return}try{null===a?localStorage.removeItem(i):localStorage.setItem(i,JSON.stringify(a))}catch(t){"undefined"!=typeof window&&console.error(t)}},[a,i]),s),g=(0,ej.useMemo)(()=>f.find(t=>t.name===d)??null,[f,d]),m=(0,ej.useCallback)(t=>{d!==t&&(g&&g.name!==ea&&g.disconnect(),p(t))},[g,p,d]);(0,ej.useEffect)(()=>{if(g)return g.on("disconnect",t),()=>{g.off("disconnect",t)};function t(){b.current||p(null)}},[g,c,p,d]);let y=(0,ej.useRef)(!1),w=(0,ej.useMemo)(()=>{if(r&&g)return async()=>{(!0===r||await r(g))&&(y.current?await g.connect():await g.autoConnect())}},[r,g]),b=(0,ej.useRef)(!1);(0,ej.useEffect)(()=>{if(d===ea&&eV(c)){b.current=!1;return}function t(){b.current=!0}return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[c,d]);let v=(0,ej.useCallback)(()=>{g&&m(null)},[g,m]),k=(0,ej.useCallback)(t=>{y.current=!0,m(t)},[m]);return ej.createElement(eH,{wallets:f,adapter:g,isUnloadingRef:b,onAutoConnectRequest:w,onConnectError:v,onError:n,onSelectWallet:k},t)}},3114:function(t,e,r){"use strict";r.d(e,{E:()=>n,w:()=>s});var i=r(5074);let n=(0,i.createContext)({});function s(){return(0,i.useContext)(n)}},3515:function(t,e,r){"use strict";r.d(e,{b:()=>a,v:()=>u});var i=r(5074);let n=[],s={autoConnect:!1,connecting:!1,connected:!1,disconnecting:!1,select(){o("call","select")},connect:()=>Promise.reject(o("call","connect")),disconnect:()=>Promise.reject(o("call","disconnect")),sendTransaction:()=>Promise.reject(o("call","sendTransaction")),signTransaction:()=>Promise.reject(o("call","signTransaction")),signAllTransactions:()=>Promise.reject(o("call","signAllTransactions")),signMessage:()=>Promise.reject(o("call","signMessage")),signIn:()=>Promise.reject(o("call","signIn"))};function o(t,e){let r=Error(`You have tried to ${t} "${e}" on a WalletContext without providing one. Make sure to render a WalletProvider as an ancestor of the component that uses WalletContext.`);return console.error(r),r}Object.defineProperty(s,"wallets",{get:()=>(o("read","wallets"),n)}),Object.defineProperty(s,"wallet",{get:()=>(o("read","wallet"),null)}),Object.defineProperty(s,"publicKey",{get:()=>(o("read","publicKey"),null)});let a=(0,i.createContext)(s);function u(){return(0,i.useContext)(a)}},1899:function(t,e,r){"use strict";r.d(e,{CE:()=>i,g4:()=>o,re:()=>s,sE:()=>n});let i="solana:mainnet",n="solana:devnet",s="solana:testnet",o="solana:localnet"},6137:function(t,e,r){"use strict";r.d(e,{GZ:()=>s,RU:()=>n});var i=r(1899);let n="https://api.mainnet-beta.solana.com";function s(t){return t.includes(n)?i.CE:/\bdevnet\b/i.test(t)?i.sE:/\btestnet\b/i.test(t)?i.re:/\blocalhost\b/i.test(t)||/\b127\.0\.0\.1\b/.test(t)?i.g4:i.CE}}}]);
|