@clerk/ui 1.0.0-snapshot.v20251218183643 → 1.0.0-snapshot.v20251224145055

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.
Files changed (110) hide show
  1. package/dist/207_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  2. package/dist/217_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  3. package/dist/360_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  4. package/dist/444_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  5. package/dist/573_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  6. package/dist/970_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  7. package/dist/ClerkUi.js +2 -2
  8. package/dist/apiKeys_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  9. package/dist/blankcaptcha_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  10. package/dist/checkout_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  11. package/dist/{checkout_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → checkout_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +1 -1
  12. package/dist/components/Checkout/CheckoutPage.js +1 -1
  13. package/dist/components/Checkout/CheckoutPage.js.map +1 -1
  14. package/dist/components/Checkout/parts.js +1 -1
  15. package/dist/components/Checkout/parts.js.map +1 -1
  16. package/dist/components/UserProfile/Web3Form.js +32 -45
  17. package/dist/components/UserProfile/Web3Form.js.map +1 -1
  18. package/dist/components/UserProfile/Web3Section.js +6 -3
  19. package/dist/components/UserProfile/Web3Section.js.map +1 -1
  20. package/dist/copy-api-key-modal_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  21. package/dist/createorganization_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  22. package/dist/enableOrganizationsPrompt_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  23. package/dist/foundations/defaultFoundations.d.ts +153 -153
  24. package/dist/framework_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  25. package/dist/impersonationfab_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  26. package/dist/index.js +1 -1
  27. package/dist/internal/index.js +1 -1
  28. package/dist/keylessPrompt_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  29. package/dist/lazyModules/components.d.ts +20 -20
  30. package/dist/oauthConsent_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  31. package/dist/onetap_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  32. package/dist/op-api-keys-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  33. package/dist/op-billing-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  34. package/dist/op-plans-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  35. package/dist/organizationlist_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  36. package/dist/organizationprofile_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  37. package/dist/organizationswitcher_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  38. package/dist/payment-attempt-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  39. package/dist/planDetails_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  40. package/dist/prefetchorganizationlist_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  41. package/dist/pricingTable_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  42. package/dist/revoke-api-key-modal_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  43. package/dist/sessionTasks_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  44. package/dist/signin_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  45. package/dist/signup_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  46. package/dist/statement-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  47. package/dist/subscriptionDetails_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  48. package/dist/taskChooseOrganization_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  49. package/dist/taskResetPassword_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  50. package/dist/ui-common_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  51. package/dist/{ui-common_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → ui-common_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +7 -7
  52. package/dist/ui.browser.js +1 -1
  53. package/dist/ui.legacy.browser.js +1 -0
  54. package/dist/up-api-keys-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  55. package/dist/up-billing-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  56. package/dist/up-plans-page_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  57. package/dist/useravatar_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  58. package/dist/userbutton_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  59. package/dist/userprofile_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  60. package/dist/{userprofile_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → userprofile_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +2 -2
  61. package/dist/userverification_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  62. package/dist/utils/errorHandler.js +1 -7
  63. package/dist/utils/errorHandler.js.map +1 -1
  64. package/dist/vendors_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  65. package/dist/{vendors_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → vendors_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +1 -1
  66. package/dist/waitlist_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  67. package/dist/web3-solana-wallet-buttons_ui_d60088_1.0.0-snapshot.v20251224145055.js +1 -0
  68. package/dist/{web3-solana-wallet-buttons_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → web3-solana-wallet-buttons_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +3 -3
  69. package/package.json +8 -5
  70. /package/dist/{207_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 207_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  71. /package/dist/{217_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 217_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  72. /package/dist/{360_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 360_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  73. /package/dist/{444_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 444_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  74. /package/dist/{573_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 573_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  75. /package/dist/{970_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → 970_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  76. /package/dist/{apiKeys_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → apiKeys_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  77. /package/dist/{blankcaptcha_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → blankcaptcha_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  78. /package/dist/{copy-api-key-modal_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → copy-api-key-modal_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  79. /package/dist/{createorganization_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → createorganization_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  80. /package/dist/{enableOrganizationsPrompt_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → enableOrganizationsPrompt_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  81. /package/dist/{framework_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → framework_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  82. /package/dist/{impersonationfab_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → impersonationfab_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  83. /package/dist/{keylessPrompt_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → keylessPrompt_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  84. /package/dist/{oauthConsent_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → oauthConsent_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  85. /package/dist/{onetap_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → onetap_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  86. /package/dist/{op-api-keys-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → op-api-keys-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  87. /package/dist/{op-billing-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → op-billing-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  88. /package/dist/{op-plans-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → op-plans-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  89. /package/dist/{organizationlist_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → organizationlist_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  90. /package/dist/{organizationprofile_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → organizationprofile_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  91. /package/dist/{organizationswitcher_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → organizationswitcher_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  92. /package/dist/{payment-attempt-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → payment-attempt-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  93. /package/dist/{planDetails_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → planDetails_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  94. /package/dist/{prefetchorganizationlist_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → prefetchorganizationlist_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  95. /package/dist/{pricingTable_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → pricingTable_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  96. /package/dist/{revoke-api-key-modal_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → revoke-api-key-modal_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  97. /package/dist/{sessionTasks_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → sessionTasks_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  98. /package/dist/{signin_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → signin_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  99. /package/dist/{signup_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → signup_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  100. /package/dist/{statement-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → statement-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  101. /package/dist/{subscriptionDetails_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → subscriptionDetails_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  102. /package/dist/{taskChooseOrganization_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → taskChooseOrganization_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  103. /package/dist/{taskResetPassword_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → taskResetPassword_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  104. /package/dist/{up-api-keys-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → up-api-keys-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  105. /package/dist/{up-billing-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → up-billing-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  106. /package/dist/{up-plans-page_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → up-plans-page_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  107. /package/dist/{useravatar_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → useravatar_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  108. /package/dist/{userbutton_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → userbutton_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  109. /package/dist/{userverification_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → userverification_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
  110. /package/dist/{waitlist_ui_b31bc8_1.0.0-snapshot.v20251218183643.js → waitlist_ui_fb7cb6_1.0.0-snapshot.v20251224145055.js} +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["188"],{35916:function(t,e,r){"use strict";r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(98114),r(10676),r(58814),r(19161),r(8451),r(88711),e.nu64=e.u32=e.u16=e.u8=e.offset=void 0,e.blob=e.seq=e.struct=e.ns64=void 0;let n=r(6826);function i(t){if(!(t instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function o(t){return i(t),n.Buffer.from(t.buffer,t.byteOffset,t.length)}class s{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){}constructor(t,e){if(!Number.isInteger(t))throw TypeError("span must be an integer");this.span=t,this.property=e}}function a(t,e){return e.property?t+"["+e.property+"]":t}class u extends s{isCount(){throw Error("ExternalLayout is abstract")}}class l extends u{isCount(){return this.layout instanceof c||this.layout instanceof h}decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.decode(t,e+this.offset)}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.layout.encode(t,e,r+this.offset)}constructor(t,e=0,r){if(!(t instanceof s))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}}class c extends s{decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(t).readUIntLE(e,this.span)}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e).writeUIntLE(t,r,this.span),this.span}constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}}class h extends s{decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(t).readUIntBE(e,this.span)}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e).writeUIntBE(t,r,this.span),this.span}constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}}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 s{decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=o(t),n=r.readUInt32LE(e);return d(r.readUInt32LE(e+4),n)}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=f(t),i=o(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}constructor(t){super(8,t)}}class g extends s{decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=o(t),n=r.readUInt32LE(e);return d(r.readInt32LE(e+4),n)}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=f(t),i=o(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}constructor(t){super(8,t)}}class m extends s{getSpan(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof u&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0,i=this.count;for(i instanceof u&&(i=i.decode(t,e));n<i;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.elementLayout,i=t.reduce((t,i)=>t+n.encode(i,e,r+t),0);return this.count instanceof u&&this.count.encode(t.length,e,r),i}constructor(t,e,r){if(!(t instanceof s))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 n=-1;e instanceof u||!(0<t.span)||(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}}class y extends s{getSpan(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{let i=n.getSpan(t,e);return e+=i,r+i},0)}catch(t){throw RangeError("indeterminate span")}return r}decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(t);let r=this.makeDestinationObject();for(let n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=r,i=0,o=0;for(let n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){let i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-n}fromArray(t){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)}}constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((t,e)=>t&&e instanceof s,!0)))throw TypeError("fields must be array of Layout instances");for(const n of("boolean"==typeof e&&void 0===r&&(r=e,e=void 0),t))if(0>n.span&&void 0===n.property)throw Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce((t,e)=>t+e.getSpan(),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}}function w(t){return 0>t&&(t+=0x100000000),t}class b extends s{decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.makeDestinationObject(),n=this.word.decode(t,e);for(let e of(this._packedSetValue(n),this.fields))void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.word.decode(e,r);for(let e of(this._packedSetValue(n),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}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 n=0;this._packedSetValue=function(t){return n=w(t),this},this._packedGetValue=function(){return n}}}class v{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)}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 n=8*t.span,i=t.fields.reduce((t,e)=>t+e.bits,0);if(e+i>n)throw Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=0xffffffff),this.start=i,this.container.msb&&(this.start=n-i-e),this.wordMask=w(this.valueMask<<this.start),this.property=r}}class k extends v{decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t*=1),super.encode(t)}constructor(t,e){super(t,1,e)}}class S extends s{getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.span;return 0>r&&(r=this.length.decode(t,e)),o(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof u&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw RangeError("encoding overruns Uint8Array");let i=o(t);return o(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof u&&this.length.encode(n,e,r),n}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}}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)},49836:function(t,e,r){"use strict";r.d(e,{Ng:()=>rB,ZX:()=>tP,Kt:()=>tL,J3:()=>tf,B2:()=>tB}),r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(98114),r(19161),r(22239),r(88711),r(50036),r(41730),r(10676),r(3568),r(95055),r(58814),r(8451),r(85074),r(30945),r(65999),r(52678),r(32880),r(25902),r(56359),r(894),r(6373),r(63418),r(93412),r(89305),r(22501);var n,i,o,s,a=r(6826),u=r(706),l=r(99948),c=r.n(l),h=r(46846),f=r.n(h),d=r(66340),p=r(58866),g=r(35916);function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){let[e,r]=t;return"".concat(e,"=").concat(function t(e){return Array.isArray(e)?"%5B"+e.map(t).join("%2C%20")+"%5D":"bigint"==typeof e?"".concat(e,"n"):encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}(r))}r(92977);var w=class extends Error{constructor(...[t,e]){let r,n;if(e){const{cause:t,...i}=e;t&&(n={cause:t}),Object.keys(i).length>0&&(r=i)}super(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};{let r="Solana error #".concat(t,"; Decode this error by running `npx @solana/errors decode -- ").concat(t);return Object.keys(e).length&&(r+=" '".concat(btoa(Object.entries(e).map(y).join("&")),"'")),"".concat(r,"`")}}(t,r),n),m(this,"cause",this.cause),m(this,"context",void 0),this.context={__code:t,...r},this.name="SolanaError"}};function b(t){return"fixedSize"in t&&"number"==typeof t.fixedSize}function v(t){return(null==t?void 0:t.endian)!==1}var k=function(){var t,e;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.freeze({...e={fixedSize:(t={config:r,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}).size,write(e,r,n){t.range&&function(t,e,r,n){if(n<e||n>r)throw new w(8078011,{codecDescription:t,max:r,min:e,value:n})}(t.name,t.range[0],t.range[1],e);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,v(t.config)),r.set(new Uint8Array(i),n),n+t.size}},encode:t=>{let r=new Uint8Array("fixedSize"in e?e.fixedSize:e.getSizeFromValue(t));return e.write(t,r,0),r}})},S=function(){var t,e;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.freeze({...e={fixedSize:(t={config:r,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}).size,read(e){var r,n,i;let o,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;!function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e.length-r<=0)throw new w(8078e3,{codecDescription:t})}(t.name,e,a),function(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=r.length-n;if(i<e)throw new w(8078001,{bytesLength:i,codecDescription:t,expected:e})}(t.name,t.size,e,a);let u=new DataView((r=e,n=a,i=t.size,o=r.byteOffset+(null!=n?n:0),s=null!=i?i:r.byteLength,r.buffer.slice(o,o+s)));return[t.get(u,v(t.config)),a+t.size]}},decode:function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.read(t,r)[0]}})},E=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e=k(t),r=S(t);if(b(e)!==b(r))throw new w(8078004);if(b(e)&&b(r)&&e.fixedSize!==r.fixedSize)throw new w(8078005,{decoderFixedSize:r.fixedSize,encoderFixedSize:e.fixedSize});if(!b(e)&&!b(r)&&e.maxSize!==r.maxSize)throw new w(8078006,{decoderMaxSize:r.maxSize,encoderMaxSize:e.maxSize});return{...r,...e,decode:r.decode,encode:e.encode,read:r.read,write:e.write}};r(25006),r(54067);class M extends TypeError{constructor(t,e){let r;const{message:n,explanation:i,...o}=t,{path:s}=t,a=0===s.length?n:"At path: ".concat(s.join(".")," -- ").concat(n);super(null!=i?i:a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>null!=r?r:r=[t,...e()]}}function A(t){return"object"==typeof t&&null!=t}function I(t){return A(t)&&!Array.isArray(t)}function x(t){return"symbol"==typeof t?t.toString():"string"==typeof t?JSON.stringify(t):"".concat(t)}function*_(t,e,r,n){var i;for(let o of(A(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]),t)){let t=function(t,e,r,n){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});let{path:i,branch:o}=e,{type:s}=r,{refinement:a,message:u="Expected a value of type `".concat(s,"`").concat(a?" with refinement `".concat(a,"`"):"",", but received: `").concat(x(n),"`")}=t;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}(o,e,r,n);t&&(yield t)}}function*B(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{path:n=[],branch:i=[t],coerce:o=!1,mask:s=!1}=r,a={path:n,branch:i,mask:s};o&&(t=e.coercer(t,a));let u="valid";for(let n of e.validator(t,a))n.explanation=r.message,u="not_valid",yield[n,void 0];for(let[l,c,h]of e.entries(t,a))for(let e of B(c,h,{path:void 0===l?n:[...n,l],branch:void 0===l?i:[...i,c],coerce:o,mask:s,message:r.message}))e[0]?(u=null!=e[0].refinement?"not_refined":"not_valid",yield[e[0],void 0]):o&&(c=e[1],void 0===l?t=c:t instanceof Map?t.set(l,c):t instanceof Set?t.add(c):A(t)&&(void 0!==c||l in t)&&(t[l]=c));if("not_valid"!==u)for(let n of e.refiner(t,a))n.explanation=r.message,u="not_refined",yield[n,void 0];"valid"===u&&(yield[void 0,t])}class T{assert(t,e){var r=t,n=this,i=e;let o=R(r,n,{message:i});if(o[0])throw o[0]}create(t,e){return C(t,this,e)}is(t){var e,r;return e=t,r=this,!R(e,r)[0]}mask(t,e){var r=t,n=this,i=e;let o=R(r,n,{coerce:!0,mask:!0,message:i});if(!o[0])return o[1];throw o[0]}validate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return R(t,this,e)}constructor(t){const{type:e,schema:r,validator:n,refiner:i,coercer:o=t=>t,entries:s=function*(){}}=t;this.type=e,this.schema=r,this.entries=s,this.coercer=o,n?this.validator=(t,e)=>_(n(t,e),e,this,t):this.validator=()=>[],i?this.refiner=(t,e)=>_(i(t,e),e,this,t):this.refiner=()=>[]}}function C(t,e,r){let n=R(t,e,{coerce:!0,message:r});if(!n[0])return n[1];throw n[0]}function R(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=B(t,e,r),i=function(t){let{done:e,value:r}=t.next();return e?void 0:r}(n);return i[0]?[new M(i[0],function*(){for(let t of n)t[0]&&(yield t[0])}),void 0]:[void 0,i[1]]}function P(t,e){return new T({type:t,schema:null,validator:e})}function L(t){return new T({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,n]of e.entries())yield[r,n,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: ".concat(x(t))})}function U(){return P("boolean",t=>"boolean"==typeof t)}function O(t){return P("instance",e=>e instanceof t||"Expected a `".concat(t.name,"` instance, but received: ").concat(x(e)))}function W(t){let e=x(t),r=typeof t;return new T({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||"Expected the literal `".concat(e,"`, but received: ").concat(x(r))})}function z(t){return new T({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function N(){return P("number",t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: ".concat(x(t)))}function j(t){return new T({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function K(t,e){return new T({type:"record",schema:null,*entries(r){if(A(r))for(let n in r){let i=r[n];yield[n,n,t],yield[n,i,e]}},validator:t=>I(t)||"Expected an object, but received: ".concat(x(t)),coercer:t=>I(t)?{...t}:t})}function q(){return P("string",t=>"string"==typeof t||"Expected a string, but received: ".concat(x(t)))}function D(t){let e=P("never",()=>!1);return new T({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator:t=>Array.isArray(t)||"Expected an array, but received: ".concat(x(t)),coercer:t=>Array.isArray(t)?t.slice():t})}function F(t){let e=Object.keys(t);return new T({type:"type",schema:t,*entries(r){if(A(r))for(let n of e)yield[n,r[n],t[n]]},validator:t=>I(t)||"Expected an object, but received: ".concat(x(t)),coercer:t=>I(t)?{...t}:t})}function H(t){let e=t.map(t=>t.type).join(" | ");return new T({type:"union",schema:null,coercer(e,r){for(let n of t){let[t,i]=n.validate(e,{coerce:!0,mask:r.mask});if(!t)return i}return e},validator(r,n){let i=[];for(let e of t){let[...t]=B(r,e,n),[o]=t;if(!o[0])return[];for(let[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `".concat(e,"`, but received: ").concat(x(r)),...i]}})}function V(){return P("unknown",()=>!0)}function J(t,e,r){return new T({...t,coercer:(n,i)=>R(n,e)[0]?t.coercer(n,i):t.coercer(r(n,i),i)})}var Y=r(62466),Z=r.n(Y),G=r(39977);function Q(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var X=class extends G.b{send(t,e,r){let n=r||e;try{this.socket.send(t),n()}catch(t){n(t)}}close(t,e){this.socket.close(t,e)}addEventListener(t,e,r){this.socket.addEventListener(t,e,r)}constructor(t,e){super(),Q(this,"socket",void 0),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)}}},$=class{encode(t){return JSON.stringify(t)}decode(t){return JSON.parse(t)}},tt=class extends G.b{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,n){return n||"object"!=typeof r||(n=r,r=null),new Promise((i,o)=>{if(!this.ready)return o(Error("socket not ready"));let s=this.generate_request_id(t,e);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e||void 0,id:s}),n,t=>{if(t)return o(t);this.queue[s]={promise:[i,o]},r&&(this.queue[s].timeout=setTimeout(()=>{delete this.queue[s],o(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,n)=>{if(!this.ready)return n(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:t,params:e}),t=>{if(t)return n(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",t=>{let{data:e}=t;e instanceof ArrayBuffer&&(e=a.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(t){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);let t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,t)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,null==e?void 0:e.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",t=>this.emit("error",t)),this.socket.addEventListener("close",r=>{let{code:n,reason:i}=r;this.ready&&setTimeout(()=>this.emit("close",n,i),0),this.ready=!1,this.socket=void 0,1e3!==n&&(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",n,i),1))})}constructor(t,e="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:o=5,...s}={},a,u){super(),Q(this,"address",void 0),Q(this,"rpc_id",void 0),Q(this,"queue",void 0),Q(this,"options",void 0),Q(this,"autoconnect",void 0),Q(this,"ready",void 0),Q(this,"reconnect",void 0),Q(this,"reconnect_timer_id",void 0),Q(this,"reconnect_interval",void 0),Q(this,"max_reconnects",void 0),Q(this,"rest_options",void 0),Q(this,"current_reconnects",void 0),Q(this,"generate_request_id",void 0),Q(this,"socket",void 0),Q(this,"webSocketFactory",void 0),Q(this,"dataPack",void 0),this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=e,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=o,this.rest_options=s,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 $,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})}},te=r(74588),tr=r(68390);u.ev.utils.randomPrivateKey;let tn=()=>{let t=u.ev.utils.randomPrivateKey(),e=ti(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),{publicKey:e,secretKey:r}},ti=u.ev.getPublicKey;function to(t){try{return u.ev.ExtendedPoint.fromHex(t),!0}catch{return!1}}let ts=(t,e)=>u.ev.sign(t,e.slice(0,32)),ta=u.ev.verify,tu=t=>a.Buffer.isBuffer(t)?t:t instanceof Uint8Array?a.Buffer.from(t.buffer,t.byteOffset,t.byteLength):a.Buffer.from(t);class tl{encode(){return a.Buffer.from((0,p.serialize)(tc,this))}static decode(t){return(0,p.deserialize)(tc,this,t)}static decodeUnchecked(t){return(0,p.deserializeUnchecked)(tc,this,t)}constructor(t){Object.assign(this,t)}}let tc=new Map,th=1;class tf extends tl{static unique(){let t=new tf(th);return th+=1,new tf(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(".concat(this.toString(),")")}toString(){return this.toBase58()}static async createWithSeed(t,e,r){let n=a.Buffer.concat([t.toBuffer(),a.Buffer.from(e),r.toBuffer()]);return new tf((0,d.sc)(n))}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,tu(t)])}),r=a.Buffer.concat([r,e.toBuffer(),a.Buffer.from("ProgramDerivedAddress")]);let n=(0,d.sc)(r);if(to(n))throw Error("Invalid seeds, address must fall off the curve");return new tf(n)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r,n=255;for(;0!=n;){try{let i=t.concat(a.Buffer.from([n]));r=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;n--;continue}return[r,n]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return to(new tf(t).toBytes())}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")}}}tf.default=new tf("11111111111111111111111111111111"),tc.set(tf,{kind:"struct",fields:[["_bn","u256"]]}),new tf("BPFLoader1111111111111111111111111111111111");class td extends Error{constructor(t){super("Signature ".concat(t," has expired: block height exceeded.")),this.signature=void 0,this.signature=t}}Object.defineProperty(td.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class tp extends Error{constructor(t,e){super("Transaction was not confirmed in ".concat(e.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools.")),this.signature=void 0,this.signature=t}}Object.defineProperty(tp.prototype,"name",{value:"TransactionExpiredTimeoutError"});class tg extends Error{constructor(t){super("Signature ".concat(t," has expired: the nonce is no longer valid.")),this.signature=void 0,this.signature=t}}Object.defineProperty(tg.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class tm{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}))}constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}}let ty=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return g.blob(32,t)},tw=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return g.blob(64,t)},tb=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=g.struct([g.u32("length"),g.u32("lengthPadding"),g.blob(g.offset(g.u32(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e);return e.decode=(t,e)=>r(t,e).chars.toString(),e.encode=(t,e,r)=>n({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 tv(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(127&n)<<7*r,r+=1,(128&n)==0)break}return e}function tk(t,e){let r=e;for(;;){let e=127&r;if(0==(r>>=7)){t.push(e);break}e|=128,t.push(e)}}function tS(t,e){if(!t)throw Error(e||"Assertion failed")}class tE{static compile(t,e){let r=new Map,n=t=>{let e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},i=n(e);for(let e of(i.isSigner=!0,i.isWritable=!0,t))for(let t of(n(e.programId).isInvoked=!0,e.keys)){let e=n(t.pubkey);e.isSigner||(e.isSigner=t.isSigner),e.isWritable||(e.isWritable=t.isWritable)}return new tE(e,r)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];tS(t.length<=256,"Max static account keys length exceeded");let e=t.filter(t=>{let[,e]=t;return e.isSigner&&e.isWritable}),r=t.filter(t=>{let[,e]=t;return e.isSigner&&!e.isWritable}),n=t.filter(t=>{let[,e]=t;return!e.isSigner&&e.isWritable}),i=t.filter(t=>{let[,e]=t;return!e.isSigner&&!e.isWritable}),o={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{tS(e.length>0,"Expected at least one writable signer key");let[t]=e[0];tS(t===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...e.map(t=>{let[e]=t;return new tf(e)}),...r.map(t=>{let[e]=t;return new tf(e)}),...n.map(t=>{let[e]=t;return new tf(e)}),...i.map(t=>{let[e]=t;return new tf(e)})]]}extractTableLookup(t){let[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&t.isWritable),[n,i]=this.drainKeysFoundInLookupTable(t.state.addresses,t=>!t.isSigner&&!t.isInvoked&&!t.isWritable);if(0!==e.length||0!==n.length)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(t,e){let r=[],n=[];for(let[i,o]of this.keyMetaMap.entries())if(e(o)){let e=new tf(i),o=t.findIndex(t=>t.equals(e));o>=0&&(tS(o<256,"Max lookup table index exceeded"),r.push(o),n.push(e),this.keyMetaMap.delete(i))}return[r,n]}constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}}let tM="Reached end of buffer unexpectedly";function tA(t){if(0===t.length)throw Error(tM);return t.shift()}function tI(t){for(var e,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];let[o]=n;if(2===n.length?o+(null!=(e=n[1])?e:0)>t.length:o>=t.length)throw Error(tM);return t.splice(...n)}class tx{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 tm(this.staticAccountKeys)}static compile(t){let[e,r]=tE.compile(t.instructions,t.payerKey).getMessageComponents(),n=new tm(r).compileInstructions(t.instructions).map(t=>({programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:f().encode(t.data)}));return new tx({header:e,accountKeys:r,recentBlockhash:t.recentBlockhash,instructions:n})}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=[];tk(e,t);let r=this.instructions.map(t=>{let{accounts:e,programIdIndex:r}=t,n=Array.from(f().decode(t.data)),i=[];tk(i,e.length);let o=[];return tk(o,n.length),{programIdIndex:r,keyIndicesCount:a.Buffer.from(i),keyIndices:e,dataLength:a.Buffer.from(o),data:n}}),n=[];tk(n,r.length);let i=a.Buffer.alloc(1232);a.Buffer.from(n).copy(i);let o=n.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,i,o);o+=e}),i=i.slice(0,o);let s=g.struct([g.blob(1,"numRequiredSignatures"),g.blob(1,"numReadonlySignedAccounts"),g.blob(1,"numReadonlyUnsignedAccounts"),g.blob(e.length,"keyCount"),g.seq(ty("key"),t,"keys"),ty("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=>tu(t.toBytes())),recentBlockhash:f().decode(this.recentBlockhash)},l=a.Buffer.alloc(2048),c=s.encode(u,l);return i.copy(l,c),l.slice(0,c+i.length)}static from(t){let e=[...t],r=tA(e);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let n=tA(e),i=tA(e),o=tv(e),s=[];for(let t=0;t<o;t++){let t=tI(e,0,32);s.push(new tf(a.Buffer.from(t)))}let u=tI(e,0,32),l=tv(e),c=[];for(let t=0;t<l;t++){let t=tA(e),r=tv(e),n=tI(e,0,r),i=tv(e),o=tI(e,0,i),s=f().encode(a.Buffer.from(o));c.push({programIdIndex:t,accounts:n,data:s})}return new tx({header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:i},recentBlockhash:f().encode(a.Buffer.from(u)),accountKeys:s,instructions:c})}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 tf(t)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}}class t_{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 tm(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 n=r-e-this.header.numReadonlyUnsignedAccounts;return t-e<n}}resolveAddressTableLookups(t){let e={writable:[],readonly:[]};for(let r of this.addressTableLookups){let n=t.find(t=>t.key.equals(r.accountKey));if(!n)throw Error("Failed to find address lookup table account for table key ".concat(r.accountKey.toBase58()));for(let t of r.writableIndexes)if(t<n.state.addresses.length)e.writable.push(n.state.addresses[t]);else throw Error("Failed to find address for index ".concat(t," in address lookup table ").concat(r.accountKey.toBase58()));for(let t of r.readonlyIndexes)if(t<n.state.addresses.length)e.readonly.push(n.state.addresses[t]);else throw Error("Failed to find address for index ".concat(t," in address lookup table ").concat(r.accountKey.toBase58()))}return e}static compile(t){let e=tE.compile(t.instructions,t.payerKey),r=[],n={writable:[],readonly:[]};for(let i of t.addressLookupTableAccounts||[]){let t=e.extractTableLookup(i);if(void 0!==t){let[e,{writable:i,readonly:o}]=t;r.push(e),n.writable.push(...i),n.readonly.push(...o)}}let[i,o]=e.getMessageComponents(),s=new tm(o,n).compileInstructions(t.instructions);return new t_({header:i,staticAccountKeys:o,recentBlockhash:t.recentBlockhash,compiledInstructions:s,addressTableLookups:r})}serialize(){let t=[];tk(t,this.staticAccountKeys.length);let e=this.serializeInstructions(),r=[];tk(r,this.compiledInstructions.length);let n=this.serializeAddressTableLookups(),i=[];tk(i,this.addressTableLookups.length);let o=g.struct([g.u8("prefix"),g.struct([g.u8("numRequiredSignatures"),g.u8("numReadonlySignedAccounts"),g.u8("numReadonlyUnsignedAccounts")],"header"),g.blob(t.length,"staticAccountKeysLength"),g.seq(ty(),this.staticAccountKeys.length,"staticAccountKeys"),ty("recentBlockhash"),g.blob(r.length,"instructionsLength"),g.blob(e.length,"serializedInstructions"),g.blob(i.length,"addressTableLookupsLength"),g.blob(n.length,"serializedAddressTableLookups")]),s=new Uint8Array(1232),a=o.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(i),serializedAddressTableLookups:n},s);return s.slice(0,a)}serializeInstructions(){let t=0,e=new Uint8Array(1232);for(let r of this.compiledInstructions){let n=[];tk(n,r.accountKeyIndexes.length);let i=[];tk(i,r.data.length);let o=g.struct([g.u8("programIdIndex"),g.blob(n.length,"encodedAccountKeyIndexesLength"),g.seq(g.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),g.blob(i.length,"encodedDataLength"),g.blob(r.data.length,"data")]);t+=o.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(n),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),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 n=[];tk(n,r.writableIndexes.length);let i=[];tk(i,r.readonlyIndexes.length);let o=g.struct([ty("accountKey"),g.blob(n.length,"encodedWritableIndexesLength"),g.seq(g.u8(),r.writableIndexes.length,"writableIndexes"),g.blob(i.length,"encodedReadonlyIndexesLength"),g.seq(g.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=o.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(n),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t],r=tA(e),n=127&r;tS(r!==n,"Expected versioned message but received legacy message"),tS(0===n,"Expected versioned message with version 0 but found version ".concat(n));let i={numRequiredSignatures:tA(e),numReadonlySignedAccounts:tA(e),numReadonlyUnsignedAccounts:tA(e)},o=[],s=tv(e);for(let t=0;t<s;t++)o.push(new tf(tI(e,0,32)));let a=f().encode(tI(e,0,32)),u=tv(e),l=[];for(let t=0;t<u;t++){let t=tA(e),r=tv(e),n=tI(e,0,r),i=tv(e),o=new Uint8Array(tI(e,0,i));l.push({programIdIndex:t,accountKeyIndexes:n,data:o})}let c=tv(e),h=[];for(let t=0;t<c;t++){let t=new tf(tI(e,0,32)),r=tv(e),n=tI(e,0,r),i=tv(e),o=tI(e,0,i);h.push({accountKey:t,writableIndexes:n,readonlyIndexes:o})}return new t_({header:i,staticAccountKeys:o,recentBlockhash:a,compiledInstructions:l,addressTableLookups:h})}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}}let tB={deserializeMessageVersion(t){let e=t[0],r=127&e;return r===e?"legacy":r},deserialize:t=>{let e=tB.deserializeMessageVersion(t);if("legacy"===e)return tx.from(t);if(0===e)return t_.deserialize(t);throw Error("Transaction message version ".concat(e," deserialization is not supported"))}},tT=((n={})[n.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",n[n.PROCESSED=1]="PROCESSED",n[n.TIMED_OUT=2]="TIMED_OUT",n[n.NONCE_INVALID=3]="NONCE_INVALID",n),tC=a.Buffer.alloc(64).fill(0);class tR{toJSON(){return{keys:this.keys.map(t=>{let{pubkey:e,isSigner:r,isWritable:n}=t;return{pubkey:e.toJSON(),isSigner:r,isWritable:n}}),programId:this.programId.toJSON(),data:[...this.data]}}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)}}class tP{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}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(t=>{let{publicKey:e}=t;return e.toJSON()})}}add(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(0===e.length)throw Error("No instructions");return e.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 tR(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 ".concat(t," has undefined program id"));let n=[],i=[];e.forEach(t=>{t.keys.forEach(t=>{i.push({...t})});let e=t.programId.toString();n.includes(e)||n.push(e)}),n.forEach(t=>{i.push({pubkey:new tf(t),isSigner:!1,isWritable:!1})});let o=[];i.forEach(t=>{let e=t.pubkey.toString(),r=o.findIndex(t=>t.pubkey.toString()===e);r>-1?(o[r].isWritable=o[r].isWritable||t.isWritable,o[r].isSigner=o[r].isSigner||t.isSigner):o.push(t)}),o.sort(function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});let s=o.findIndex(t=>t.pubkey.equals(r));if(s>-1){let[t]=o.splice(s,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let t of this.signatures){let e=o.findIndex(e=>e.pubkey.equals(t.publicKey));if(e>-1)o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw Error("unknown signer: ".concat(t.publicKey.toString()))}let a=0,u=0,l=0,c=[],h=[];o.forEach(t=>{let{pubkey:e,isSigner:r,isWritable:n}=t;r?(c.push(e.toString()),a+=1,n||(u+=1)):(h.push(e.toString()),n||(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=>{tS(t.programIdIndex>=0),t.accounts.forEach(t=>tS(t>=0))}),new tx({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(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(0===e.length)throw Error("No signers");let n=new Set;this.signatures=e.filter(t=>{let e=t.toString();return!n.has(e)&&(n.add(e),!0)}).map(t=>({signature:null,publicKey:t}))}sign(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(0===e.length)throw Error("No signers");let n=new Set,i=[];for(let t of e){let e=t.publicKey.toString();n.has(e)||(n.add(e),i.push(t))}this.signatures=i.map(t=>({signature:null,publicKey:t.publicKey}));let o=this._compile();this._partialSign(o,...i)}partialSign(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(0===e.length)throw Error("No signers");let n=new Set,i=[];for(let t of e){let e=t.publicKey.toString();n.has(e)||(n.add(e),i.push(t))}let o=this._compile();this._partialSign(o,...i)}_partialSign(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];let i=t.serialize();r.forEach(t=>{let e=ts(i,t.secretKey);this._addSignature(t.publicKey,tu(e))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){tS(64===e.length);let r=this.signatures.findIndex(e=>t.equals(e.publicKey));if(r<0)throw Error("unknown signer: ".concat(t.toString()));this.signatures[r].signature=a.Buffer.from(e)}verifySignatures(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let r={};for(let{signature:n,publicKey:i}of this.signatures)null===n?e&&(r.missing||(r.missing=[])).push(i):ta(n,t,i.toBytes())||(r.invalid||(r.invalid=[])).push(i);return r.invalid||r.missing?r:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),n=this.serializeMessage();if(r){let t=this._getMessageSignednessErrors(n,e);if(t){let e="Signature verification failed.";throw t.invalid&&(e+="\nInvalid signature for public key".concat(1===t.invalid.length?"":"(s)"," [`").concat(t.invalid.map(t=>t.toBase58()).join("`, `"),"`].")),t.missing&&(e+="\nMissing signature for public key".concat(1===t.missing.length?"":"(s)"," [`").concat(t.missing.map(t=>t.toBase58()).join("`, `"),"`].")),Error(e)}}return this._serialize(n)}_serialize(t){let{signatures:e}=this,r=[];tk(r,e.length);let n=r.length+64*e.length+t.length,i=a.Buffer.alloc(n);return tS(e.length<256),a.Buffer.from(r).copy(i,0),e.forEach((t,e)=>{let{signature:n}=t;null!==n&&(tS(64===n.length,"signature has invalid length"),a.Buffer.from(n).copy(i,r.length+64*e))}),t.copy(i,r.length+64*e.length),tS(i.length<=1232,"Transaction too large: ".concat(i.length," > ").concat(1232)),i}get keys(){return tS(1===this.instructions.length),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return tS(1===this.instructions.length),this.instructions[0].programId}get data(){return tS(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t],r=tv(e),n=[];for(let t=0;t<r;t++){let t=tI(e,0,64);n.push(f().encode(a.Buffer.from(t)))}return tP.populate(tx.from(e),n)}static populate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new tP;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach((e,n)=>{let i={signature:e==f().encode(tC)?null:f().decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)}),t.instructions.forEach(e=>{let n=e.accounts.map(e=>{let n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some(t=>t.publicKey.toString()===n.toString())||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}});r.instructions.push(new tR({keys:n,programId:t.accountKeys[e.programIdIndex],data:f().decode(e.data)}))}),r._message=t,r._json=r.toJSON(),r}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}}}class tL{get version(){return this.message.version}serialize(){let t=this.message.serialize(),e=[];tk(e,this.signatures.length);let r=g.struct([g.blob(e.length,"encodedSignaturesLength"),g.seq(tw(),this.signatures.length,"signatures"),g.blob(t.length,"serializedMessage")]),n=new Uint8Array(2048),i=r.encode({encodedSignaturesLength:new Uint8Array(e),signatures:this.signatures,serializedMessage:t},n);return n.slice(0,i)}static deserialize(t){let e=[...t],r=[],n=tv(e);for(let t=0;t<n;t++)r.push(new Uint8Array(tI(e,0,64)));return new tL(tB.deserialize(new Uint8Array(e)),r)}sign(t){let e=this.message.serialize(),r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(let n of t){let t=r.findIndex(t=>t.equals(n.publicKey));tS(t>=0,"Cannot sign with non signer key ".concat(n.publicKey.toBase58())),this.signatures[t]=ts(e,n.secretKey)}}addSignature(t,e){tS(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));tS(r>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[r]=e}constructor(t,e){if(this.signatures=void 0,this.message=void 0,void 0!==e)tS(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}}let tU=new tf("SysvarC1ock11111111111111111111111111111111");new tf("SysvarEpochSchedu1e111111111111111111111111"),new tf("Sysvar1nstructions1111111111111111111111111");let tO=new tf("SysvarRecentB1ockHashes11111111111111111111"),tW=new tf("SysvarRent111111111111111111111111111111111");new tf("SysvarRewards111111111111111111111111111111"),new tf("SysvarS1otHashes111111111111111111111111111"),new tf("SysvarS1otHistory11111111111111111111111111");let tz=new tf("SysvarStakeHistory1111111111111111111111111");class tN extends Error{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}constructor({action:t,signature:e,transactionMessage:r,logs:n}){let i;const o=n?"Logs: \n".concat(JSON.stringify(n.slice(-10),null,2),". "):"",s="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";switch(t){case"send":i="Transaction ".concat(e," resulted in an error. \n")+"".concat(r,". ")+o+s;break;case"simulate":i="Simulation failed. \nMessage: ".concat(r,". \n")+o+s;break;default:i="Unknown action '".concat(t,"'")}super(i),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=r,this.transactionLogs=n||void 0}}class tj extends Error{constructor({code:t,message:e,data:r},n){super(null!=n?"".concat(n,": ").concat(e):e),this.code=void 0,this.data=void 0,this.code=t,this.data=r,this.name="SolanaJSONRPCError"}}async function tK(t,e,r,n){let i,o=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},s=await t.sendTransaction(e,r,o);if(null!=e.recentBlockhash&&null!=e.lastValidBlockHeight)i=(await t.confirmTransaction({abortSignal:null==n?void 0:n.abortSignal,signature:s,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},n&&n.commitment)).value;else if(null!=e.minNonceContextSlot&&null!=e.nonceInfo){let{nonceInstruction:r}=e.nonceInfo,o=r.keys[0].pubkey;i=(await t.confirmTransaction({abortSignal:null==n?void 0:n.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:o,nonceValue:e.nonceInfo.nonce,signature:s},n&&n.commitment)).value}else(null==n?void 0:n.abortSignal)!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),i=(await t.confirmTransaction(s,n&&n.commitment)).value;if(i.err){if(null!=s)throw new tN({action:"send",signature:s,transactionMessage:"Status: (".concat(JSON.stringify(i),")")});throw Error("Transaction ".concat(s," failed (").concat(JSON.stringify(i),")"))}return s}function tq(t){return new Promise(e=>setTimeout(e,t))}function tD(t,e){let r=t.layout.span>=0?t.layout.span:function t(e,r){let n=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*n(e.elementLayout)}else if("fields"in e)return t({layout:e},r[e.property]);return 0},i=0;return e.layout.fields.forEach(t=>{i+=n(t)}),i}(t,e),n=a.Buffer.alloc(r),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,n),n}let tF=g.nu64("lamportsPerSignature"),tH=g.struct([g.u32("version"),g.u32("state"),ty("authorizedPubkey"),ty("nonce"),g.struct([tF],"feeCalculator")]),tV=tH.span;class tJ{static fromAccountData(t){let e=tH.decode(tu(t),0);return new tJ({authorizedPubkey:new tf(e.authorizedPubkey),nonce:new tf(e.nonce).toString(),feeCalculator:e.feeCalculator})}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}}function tY(t){let e=(0,g.blob)(8,t),r=e.decode.bind(e),n=e.encode.bind(e),i=E();return e.decode=(t,e)=>{let n=r(t,e);return i.decode(n)},e.encode=(t,e,r)=>n(i.encode(t),e,r),e}let tZ=Object.freeze({Create:{index:0,layout:g.struct([g.u32("instruction"),g.ns64("lamports"),g.ns64("space"),ty("programId")])},Assign:{index:1,layout:g.struct([g.u32("instruction"),ty("programId")])},Transfer:{index:2,layout:g.struct([g.u32("instruction"),tY("lamports")])},CreateWithSeed:{index:3,layout:g.struct([g.u32("instruction"),ty("base"),tb("seed"),g.ns64("lamports"),g.ns64("space"),ty("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"),ty("authorized")])},AuthorizeNonceAccount:{index:7,layout:g.struct([g.u32("instruction"),ty("authorized")])},Allocate:{index:8,layout:g.struct([g.u32("instruction"),g.ns64("space")])},AllocateWithSeed:{index:9,layout:g.struct([g.u32("instruction"),ty("base"),tb("seed"),g.ns64("space"),ty("programId")])},AssignWithSeed:{index:10,layout:g.struct([g.u32("instruction"),ty("base"),tb("seed"),ty("programId")])},TransferWithSeed:{index:11,layout:g.struct([g.u32("instruction"),tY("lamports"),tb("seed"),ty("programId")])},UpgradeNonceAccount:{index:12,layout:g.struct([g.u32("instruction")])}});class tG{static createAccount(t){let e=tD(tZ.Create,{lamports:t.lamports,space:t.space,programId:tu(t.programId.toBuffer())});return new tR({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=tD(tZ.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:tu(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=tD(tZ.Transfer,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new tR({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;return"basePubkey"in t?(e=tD(tZ.AssignWithSeed,{base:tu(t.basePubkey.toBuffer()),seed:t.seed,programId:tu(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=tD(tZ.Assign,{programId:tu(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tR({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=tD(tZ.CreateWithSeed,{base:tu(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:tu(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 tR({keys:r,programId:this.programId,data:e})}static createNonceAccount(t){let e=new tP;"basePubkey"in t&&"seed"in t?e.add(tG.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:tV,programId:this.programId})):e.add(tG.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:tV,programId:this.programId}));let r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){let e=tD(tZ.InitializeNonceAccount,{authorized:tu(t.authorizedPubkey.toBuffer())});return new tR({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tO,isSigner:!1,isWritable:!1},{pubkey:tW,isSigner:!1,isWritable:!1}],programId:this.programId,data:e})}static nonceAdvance(t){let e=tD(tZ.AdvanceNonceAccount);return new tR({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:tO,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceWithdraw(t){let e=tD(tZ.WithdrawNonceAccount,{lamports:t.lamports});return new tR({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:tO,isSigner:!1,isWritable:!1},{pubkey:tW,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){let e=tD(tZ.AuthorizeNonceAccount,{authorized:tu(t.newAuthorizedPubkey.toBuffer())});return new tR({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=tD(tZ.AllocateWithSeed,{base:tu(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:tu(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=tD(tZ.Allocate,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new tR({keys:r,programId:this.programId,data:e})}constructor(){}}tG.programId=new tf("11111111111111111111111111111111");class tQ{static getMinNumSignatures(t){return 2*(Math.ceil(t/tQ.chunkSize)+1+1)}static async load(t,e,r,n,i){{let o=await t.getMinimumBalanceForRentExemption(i.length),s=await t.getAccountInfo(r.publicKey,"confirmed"),a=null;if(null!==s){if(s.executable)return console.error("Program load failed, account is already executable"),!1;s.data.length!==i.length&&(a=a||new tP).add(tG.allocate({accountPubkey:r.publicKey,space:i.length})),s.owner.equals(n)||(a=a||new tP).add(tG.assign({accountPubkey:r.publicKey,programId:n})),s.lamports<o&&(a=a||new tP).add(tG.transfer({fromPubkey:e.publicKey,toPubkey:r.publicKey,lamports:o-s.lamports}))}else a=new tP().add(tG.createAccount({fromPubkey:e.publicKey,newAccountPubkey:r.publicKey,lamports:o>0?o:1,space:i.length,programId:n}));null!==a&&await tK(t,a,[e,r],{commitment:"confirmed"})}let o=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")]),s=tQ.chunkSize,u=0,l=i,c=[];for(;l.length>0;){let i=l.slice(0,s),h=a.Buffer.alloc(s+16);o.encode({instruction:0,offset:u,bytes:i,bytesLength:0,bytesLengthPadding:0},h);let f=new tP().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:n,data:h});c.push(tK(t,f,[e,r],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await tq(250),u+=s,l=l.slice(s)}await Promise.all(c);{let i=g.struct([g.u32("instruction")]),o=a.Buffer.alloc(i.span);i.encode({instruction:1},o);let s=new tP().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:tW,isSigner:!1,isWritable:!1}],programId:n,data:o}),u="processed",l=await t.sendTransaction(s,[e,r],{preflightCommitment:u}),{context:c,value:h}=await t.confirmTransaction({signature:l,lastValidBlockHeight:s.lastValidBlockHeight,blockhash:s.recentBlockhash},u);if(h.err)throw Error("Transaction ".concat(l," failed (").concat(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}constructor(){}}tQ.chunkSize=932,new tf("BPFLoader2111111111111111111111111111111111");var tX=(i=function(){if(s)return o;s=1;var t=Object.prototype.toString,e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};return o=function(r){var n=function r(n,i){var o,s,a,u,l,c,h;if(!0===n)return"true";if(!1===n)return"false";switch(typeof n){case"object":if(null===n)return null;if(n.toJSON&&"function"==typeof n.toJSON)return r(n.toJSON(),i);if("[object Array]"===(h=t.call(n))){for(o=0,a="[",s=n.length-1;o<s;o++)a+=r(n[o],!0)+",";return s>-1&&(a+=r(n[o],!0)),a+"]"}if("[object Object]"!==h)return JSON.stringify(n);for(s=(u=e(n).sort()).length,a="",o=0;o<s;)void 0!==(c=r(n[l=u[o]],!1))&&(a&&(a+=","),a+=JSON.stringify(l)+":"+c),o++;return"{"+a+"}";case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(n);default:return isFinite(n)?n:null}}(r,!1);if(void 0!==n)return""+n}}())&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;function t$(t){let e=0;for(;t>1;)t/=2,e++;return e}class t0{getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){var e;let r=t$(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))-t$(32)-1,n=this.getSlotsInEpoch(r);return[r,t-(n-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+t$(32)):this.slotsPerEpoch}constructor(t,e,r,n,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=r,this.firstNormalEpoch=n,this.firstNormalSlot=i}}var t1=globalThis.fetch;class t2 extends tt{call(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];let i=null==(t=this.underlyingSocket)?void 0:t.readyState;return 1===i?super.call(...r):Promise.reject(Error("Tried to call a JSON-RPC method `"+r[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+i+")"))}notify(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];let i=null==(t=this.underlyingSocket)?void 0:t.readyState;return 1===i?super.notify(...r):Promise.reject(Error("Tried to send a JSON-RPC notification `"+r[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+i+")"))}constructor(t,e,r){super(t=>{let r=new X(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}}class t3{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 ".concat(r.typeIndex," != ").concat(t.index));return r}(t8,t),r=t.length-56;tS(r>=0,"lookup table is invalid"),tS(r%32==0,"lookup table is invalid");let{addresses:n}=g.struct([g.seq(ty(),r/32,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new tf(e.authority[0]):void 0,addresses:n.map(t=>new tf(t))}}constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}}let t8={index:1,layout:g.struct([g.u32("typeIndex"),tY("deactivationSlot"),g.nu64("lastExtendedSlot"),g.u8("lastExtendedStartIndex"),g.u8(),g.seq(ty(),g.offset(g.u8(),-1),"authority")])},t6=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,t5=J(O(tf),q(),t=>new tf(t)),t4=D([q(),W("base64")]),t9=J(O(a.Buffer),t4,t=>a.Buffer.from(t[0],"base64"));function t7(t){let e,r;if("string"==typeof t)e=t;else if(t){let{commitment:n,...i}=t;e=n,r=i}return{commitment:e,config:r}}function et(t){return t.map(t=>{var e;return"memcmp"in t?{...t,memcmp:{...t.memcmp,encoding:null!=(e=t.memcmp.encoding)?e:"base58"}}:t})}function ee(t){return H([F({jsonrpc:W("2.0"),id:q(),result:t}),F({jsonrpc:W("2.0"),id:q(),error:F({code:V(),message:q(),data:j(P("any",()=>!0))})})])}let er=ee(V());function en(t){return J(ee(t),er,e=>"error"in e?e:{...e,result:C(e.result,t)})}function ei(t){return en(F({context:F({slot:N()}),value:t}))}function eo(t){return F({context:F({slot:N()}),value:t})}function es(t,e){return 0===t?new t_({header:e.header,staticAccountKeys:e.accountKeys.map(t=>new tf(t)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:f().decode(t.data)})),addressTableLookups:e.addressTableLookups}):new tx(e)}let ea=F({foundation:N(),foundationTerm:N(),initial:N(),taper:N(),terminal:N()}),eu=en(L(z(F({epoch:N(),effectiveSlot:N(),amount:N(),postBalance:N(),commission:j(z(N()))})))),el=L(F({slot:N(),prioritizationFee:N()})),ec=F({total:N(),validator:N(),foundation:N(),epoch:N()}),eh=F({epoch:N(),slotIndex:N(),slotsInEpoch:N(),absoluteSlot:N(),blockHeight:j(N()),transactionCount:j(N())}),ef=F({slotsPerEpoch:N(),leaderScheduleSlotOffset:N(),warmup:U(),firstNormalEpoch:N(),firstNormalSlot:N()}),ed=K(q(),L(N())),ep=z(H([F({}),q()])),eg=F({err:ep}),em=W("receivedSignature"),ey=F({"solana-core":q(),"feature-set":j(N())}),ew=F({program:q(),programId:t5,parsed:V()}),eb=F({programId:t5,accounts:L(t5),data:q()}),ev=ei(F({err:z(H([F({}),q()])),logs:z(L(q())),accounts:j(z(L(z(F({executable:U(),owner:q(),lamports:N(),data:L(q()),rentEpoch:j(N())}))))),unitsConsumed:j(N()),returnData:j(z(F({programId:q(),data:D([q(),W("base64")])}))),innerInstructions:j(z(L(F({index:N(),instructions:L(H([ew,eb]))}))))})),ek=ei(F({byIdentity:K(q(),L(N())),range:F({firstSlot:N(),lastSlot:N()})})),eS=en(ea),eE=en(ec),eM=en(el),eA=en(eh),eI=en(ef),ex=en(ed),e_=en(N()),eB=ei(F({total:N(),circulating:N(),nonCirculating:N(),nonCirculatingAccounts:L(t5)})),eT=F({amount:q(),uiAmount:z(N()),decimals:N(),uiAmountString:j(q())}),eC=ei(L(F({address:t5,amount:q(),uiAmount:z(N()),decimals:N(),uiAmountString:j(q())}))),eR=ei(L(F({pubkey:t5,account:F({executable:U(),owner:t5,lamports:N(),data:t9,rentEpoch:N()})}))),eP=F({program:q(),parsed:V(),space:N()}),eL=ei(L(F({pubkey:t5,account:F({executable:U(),owner:t5,lamports:N(),data:eP,rentEpoch:N()})}))),eU=ei(L(F({lamports:N(),address:t5}))),eO=F({executable:U(),owner:t5,lamports:N(),data:t9,rentEpoch:N()}),eW=F({pubkey:t5,account:eO}),ez=J(H([O(a.Buffer),eP]),H([t4,eP]),t=>Array.isArray(t)?C(t,t9):t),eN=F({executable:U(),owner:t5,lamports:N(),data:ez,rentEpoch:N()}),ej=F({pubkey:t5,account:eN}),eK=F({state:H([W("active"),W("inactive"),W("activating"),W("deactivating")]),active:N(),inactive:N()}),eq=en(L(F({signature:q(),slot:N(),err:ep,memo:z(q()),blockTime:j(z(N()))}))),eD=en(L(F({signature:q(),slot:N(),err:ep,memo:z(q()),blockTime:j(z(N()))}))),eF=F({subscription:N(),result:eo(eO)}),eH=F({pubkey:t5,account:eO}),eV=F({subscription:N(),result:eo(eH)}),eJ=F({parent:N(),slot:N(),root:N()}),eY=F({subscription:N(),result:eJ}),eZ=H([F({type:H([W("firstShredReceived"),W("completed"),W("optimisticConfirmation"),W("root")]),slot:N(),timestamp:N()}),F({type:W("createdBank"),parent:N(),slot:N(),timestamp:N()}),F({type:W("frozen"),slot:N(),timestamp:N(),stats:F({numTransactionEntries:N(),numSuccessfulTransactions:N(),numFailedTransactions:N(),maxTransactionsPerEntry:N()})}),F({type:W("dead"),slot:N(),timestamp:N(),err:q()})]),eG=F({subscription:N(),result:eZ}),eQ=F({subscription:N(),result:eo(H([eg,em]))}),eX=F({subscription:N(),result:N()}),e$=F({pubkey:q(),gossip:z(q()),tpu:z(q()),rpc:z(q()),version:z(q())}),e0=F({votePubkey:q(),nodePubkey:q(),activatedStake:N(),epochVoteAccount:U(),epochCredits:L(D([N(),N(),N()])),commission:N(),lastVote:N(),rootSlot:z(N())}),e1=en(F({current:L(e0),delinquent:L(e0)})),e2=H([W("processed"),W("confirmed"),W("finalized")]),e3=F({slot:N(),confirmations:z(N()),err:ep,confirmationStatus:j(e2)}),e8=ei(L(z(e3))),e6=en(N()),e5=F({accountKey:t5,writableIndexes:L(N()),readonlyIndexes:L(N())}),e4=F({signatures:L(q()),message:F({accountKeys:L(q()),header:F({numRequiredSignatures:N(),numReadonlySignedAccounts:N(),numReadonlyUnsignedAccounts:N()}),instructions:L(F({accounts:L(N()),data:q(),programIdIndex:N()})),recentBlockhash:q(),addressTableLookups:j(L(e5))})}),e9=F({pubkey:t5,signer:U(),writable:U(),source:j(H([W("transaction"),W("lookupTable")]))}),e7=F({accountKeys:L(e9),signatures:L(q())}),rt=F({parsed:V(),program:q(),programId:t5}),re=F({accounts:L(t5),data:q(),programId:t5}),rr=J(H([re,rt]),H([F({parsed:V(),program:q(),programId:q()}),F({accounts:L(q()),data:q(),programId:q()})]),t=>"accounts"in t?C(t,re):C(t,rt)),rn=F({signatures:L(q()),message:F({accountKeys:L(e9),instructions:L(rr),recentBlockhash:q(),addressTableLookups:j(z(L(e5)))})}),ri=F({accountIndex:N(),mint:q(),owner:j(q()),programId:j(q()),uiTokenAmount:eT}),ro=F({writable:L(t5),readonly:L(t5)}),rs=F({err:ep,fee:N(),innerInstructions:j(z(L(F({index:N(),instructions:L(F({accounts:L(N()),data:q(),programIdIndex:N()}))})))),preBalances:L(N()),postBalances:L(N()),logMessages:j(z(L(q()))),preTokenBalances:j(z(L(ri))),postTokenBalances:j(z(L(ri))),loadedAddresses:j(ro),computeUnitsConsumed:j(N()),costUnits:j(N())}),ra=F({err:ep,fee:N(),innerInstructions:j(z(L(F({index:N(),instructions:L(rr)})))),preBalances:L(N()),postBalances:L(N()),logMessages:j(z(L(q()))),preTokenBalances:j(z(L(ri))),postTokenBalances:j(z(L(ri))),loadedAddresses:j(ro),computeUnitsConsumed:j(N()),costUnits:j(N())}),ru=H([W(0),W("legacy")]),rl=F({pubkey:q(),lamports:N(),postBalance:z(N()),rewardType:z(q()),commission:j(z(N()))}),rc=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),transactions:L(F({transaction:e4,meta:z(rs),version:j(ru)})),rewards:j(L(rl)),blockTime:z(N()),blockHeight:z(N())}))),rh=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),rewards:j(L(rl)),blockTime:z(N()),blockHeight:z(N())}))),rf=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),transactions:L(F({transaction:e7,meta:z(rs),version:j(ru)})),rewards:j(L(rl)),blockTime:z(N()),blockHeight:z(N())}))),rd=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),transactions:L(F({transaction:rn,meta:z(ra),version:j(ru)})),rewards:j(L(rl)),blockTime:z(N()),blockHeight:z(N())}))),rp=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),transactions:L(F({transaction:e7,meta:z(ra),version:j(ru)})),rewards:j(L(rl)),blockTime:z(N()),blockHeight:z(N())}))),rg=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),rewards:j(L(rl)),blockTime:z(N()),blockHeight:z(N())}))),rm=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),transactions:L(F({transaction:e4,meta:z(rs)})),rewards:j(L(rl)),blockTime:z(N())}))),ry=en(z(F({blockhash:q(),previousBlockhash:q(),parentSlot:N(),signatures:L(q()),blockTime:z(N())}))),rw=en(z(F({slot:N(),meta:z(rs),blockTime:j(z(N())),transaction:e4,version:j(ru)}))),rb=en(z(F({slot:N(),transaction:rn,meta:z(ra),blockTime:j(z(N())),version:j(ru)}))),rv=ei(F({blockhash:q(),lastValidBlockHeight:N()})),rk=ei(U()),rS=en(L(F({slot:N(),numTransactions:N(),numSlots:N(),samplePeriodSecs:N()}))),rE=ei(z(F({feeCalculator:F({lamportsPerSignature:N()})}))),rM=en(q()),rA=en(q()),rI=F({err:ep,logs:L(q()),signature:q()}),rx=F({result:eo(rI),subscription:N()}),r_={"solana-client":"js/1.0.0-maintenance"};class rB{get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgs([t.toBase58()],r,void 0,n),o=C(await this._rpcRequest("getBalance",i),ei(N()));if("error"in o)throw new tj(o.error,"failed to get balance for ".concat(t.toBase58()));return o.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=C(await this._rpcRequest("getBlockTime",[t]),en(z(N())));if("error"in e)throw new tj(e.error,"failed to get block time for slot ".concat(t));return e.result}async getMinimumLedgerSlot(){let t=C(await this._rpcRequest("minimumLedgerSlot",[]),en(N()));if("error"in t)throw new tj(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){let t=C(await this._rpcRequest("getFirstAvailableBlock",[]),e_);if("error"in t)throw new tj(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=C(await this._rpcRequest("getSupply",[e]),eB);if("error"in r)throw new tj(r.error,"failed to get supply");return r.result}async getTokenSupply(t,e){let r=this._buildArgs([t.toBase58()],e),n=C(await this._rpcRequest("getTokenSupply",r),ei(eT));if("error"in n)throw new tj(n.error,"failed to get token supply");return n.result}async getTokenAccountBalance(t,e){let r=this._buildArgs([t.toBase58()],e),n=C(await this._rpcRequest("getTokenAccountBalance",r),ei(eT));if("error"in n)throw new tj(n.error,"failed to get token account balance");return n.result}async getTokenAccountsByOwner(t,e,r){let{commitment:n,config:i}=t7(r),o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});let s=this._buildArgs(o,n,"base64",i),a=C(await this._rpcRequest("getTokenAccountsByOwner",s),eR);if("error"in a)throw new tj(a.error,"failed to get token accounts owned by account ".concat(t.toBase58()));return a.result}async getParsedTokenAccountsByOwner(t,e,r){let n=[t.toBase58()];"mint"in e?n.push({mint:e.mint.toBase58()}):n.push({programId:e.programId.toBase58()});let i=this._buildArgs(n,r,"jsonParsed"),o=C(await this._rpcRequest("getTokenAccountsByOwner",i),eL);if("error"in o)throw new tj(o.error,"failed to get token accounts owned by account ".concat(t.toBase58()));return o.result}async getLargestAccounts(t){let e={...t,commitment:t&&t.commitment||this.commitment},r=e.filter||e.commitment?[e]:[],n=C(await this._rpcRequest("getLargestAccounts",r),eU);if("error"in n)throw new tj(n.error,"failed to get largest accounts");return n.result}async getTokenLargestAccounts(t,e){let r=this._buildArgs([t.toBase58()],e),n=C(await this._rpcRequest("getTokenLargestAccounts",r),eC);if("error"in n)throw new tj(n.error,"failed to get token largest accounts");return n.result}async getAccountInfoAndContext(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgs([t.toBase58()],r,"base64",n),o=C(await this._rpcRequest("getAccountInfo",i),ei(z(eO)));if("error"in o)throw new tj(o.error,"failed to get info about account ".concat(t.toBase58()));return o.result}async getParsedAccountInfo(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgs([t.toBase58()],r,"jsonParsed",n),o=C(await this._rpcRequest("getAccountInfo",i),ei(z(eN)));if("error"in o)throw new tj(o.error,"failed to get info about account ".concat(t.toBase58()));return o.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:n}=t7(e),i=t.map(t=>t.toBase58()),o=this._buildArgs([i],r,"jsonParsed",n),s=C(await this._rpcRequest("getMultipleAccounts",o),ei(L(z(eN))));if("error"in s)throw new tj(s.error,"failed to get info for accounts ".concat(i));return s.result}async getMultipleAccountsInfoAndContext(t,e){let{commitment:r,config:n}=t7(e),i=t.map(t=>t.toBase58()),o=this._buildArgs([i],r,"base64",n),s=C(await this._rpcRequest("getMultipleAccounts",o),ei(L(z(eO))));if("error"in s)throw new tj(s.error,"failed to get info for accounts ".concat(i));return s.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,r){let{commitment:n,config:i}=t7(e),o=this._buildArgs([t.toBase58()],n,void 0,{...i,epoch:null!=r?r:null==i?void 0:i.epoch}),s=C(await this._rpcRequest("getStakeActivation",o),en(eK));if("error"in s)throw new tj(s.error,"failed to get Stake Activation ".concat(t.toBase58()));return s.result}async getProgramAccounts(t,e){let{commitment:r,config:n}=t7(e),{encoding:i,...o}=n||{},s=this._buildArgs([t.toBase58()],r,i||"base64",{...o,...o.filters?{filters:et(o.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",s),u=L(eW),l=!0===o.withContext?C(a,ei(u)):C(a,en(u));if("error"in l)throw new tj(l.error,"failed to get accounts owned by program ".concat(t.toBase58()));return l.result}async getParsedProgramAccounts(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgs([t.toBase58()],r,"jsonParsed",n),o=C(await this._rpcRequest("getProgramAccounts",i),en(L(ej)));if("error"in o)throw new tj(o.error,"failed to get accounts owned by program ".concat(t.toBase58()));return o.result}async confirmTransaction(t,e){let r,n;if("string"==typeof t)r=t;else{var i;if(null==(i=t.abortSignal)?void 0:i.aborted)return Promise.reject(t.abortSignal.reason);r=t.signature}try{n=f().decode(r)}catch(t){throw Error("signature must be base58 encoded: "+r)}return(tS(64===n.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(t){let e,r,{commitment:n,signature:i}=t,o=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=e&&(this.removeSignatureListener(e),e=void 0)},confirmationPromise:new Promise((t,s)=>{try{e=this.onSignature(i,(r,n)=>{e=void 0,t({__type:tT.PROCESSED,response:{context:n,value:r}})},n);let a=new Promise(t=>{null==e?t():r=this._onSubscriptionStateChange(e,e=>{"subscribed"===e&&t()})});(async()=>{if(await a,o)return;let e=await this.getSignatureStatus(i);if(o||null==e)return;let{context:r,value:u}=e;if(null!=u)if(null==u?void 0:u.err)s(u.err);else{switch(n){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}o=!0,t({__type:tT.PROCESSED,response:{context:r,value:u}})}})()}catch(t){s(t)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy(t){let e,{commitment:r,strategy:{abortSignal:n,lastValidBlockHeight:i,signature:o}}=t,s=!1,a=new Promise(t=>{let e=async()=>{try{return await this.getBlockHeight(r)}catch(t){return -1}};(async()=>{let r=await e();if(!s){for(;r<=i;)if(await tq(1e3),s||(r=await e(),s))return;t({__type:tT.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:u,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:r,signature:o}),c=this.getCancellationPromise(n);try{let t=await Promise.race([c,l,a]);if(t.__type===tT.PROCESSED)e=t.response;else throw new td(o)}finally{s=!0,u()}return e}async confirmTransactionUsingDurableNonceStrategy(t){let e,{commitment:r,strategy:{abortSignal:n,minContextSlot:i,nonceAccountPubkey:o,nonceValue:s,signature:a}}=t,u=!1,l=new Promise(t=>{let e=s,n=null,a=async()=>{try{let{context:t,value:e}=await this.getNonceAndContext(o,{commitment:r,minContextSlot:i});return n=t.slot,null==e?void 0:e.nonce}catch(t){return e}};(async()=>{if(e=await a(),!u)for(;;){if(s!==e)return void t({__type:tT.NONCE_INVALID,slotInWhichNonceDidAdvance:n});if(await tq(2e3),u||(e=await a(),u))return}})()}),{abortConfirmation:c,confirmationPromise:h}=this.getTransactionConfirmationPromise({commitment:r,signature:a}),f=this.getCancellationPromise(n);try{let t=await Promise.race([f,h,l]);if(t.__type===tT.PROCESSED)e=t.response;else{var d;let n;for(;;){let e=await this.getSignatureStatus(a);if(null==e)break;if(e.context.slot<(null!=(d=t.slotInWhichNonceDidAdvance)?d:i)){await tq(400);continue}n=e;break}if(null==n?void 0:n.value){let t=r||"finalized",{confirmationStatus:i}=n.value;switch(t){case"processed":case"recent":if("processed"!==i&&"confirmed"!==i&&"finalized"!==i)throw new tg(a);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==i&&"finalized"!==i)throw new tg(a);break;case"finalized":case"max":case"root":if("finalized"!==i)throw new tg(a)}e={context:n.context,value:{err:n.value.err}}}else throw new tg(a)}}finally{u=!0,c()}return e}async confirmTransactionUsingLegacyTimeoutStrategy(t){let e,r,{commitment:n,signature:i}=t,o=new Promise(t=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}e=setTimeout(()=>t({__type:tT.TIMED_OUT,timeoutMs:r}),r)}),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:n,signature:i});try{let t=await Promise.race([a,o]);if(t.__type===tT.PROCESSED)r=t.response;else throw new tp(i,t.timeoutMs/1e3)}finally{clearTimeout(e),s()}return r}async getClusterNodes(){let t=C(await this._rpcRequest("getClusterNodes",[]),en(L(e$)));if("error"in t)throw new tj(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){let e=this._buildArgs([],t),r=C(await this._rpcRequest("getVoteAccounts",e),e1);if("error"in r)throw new tj(r.error,"failed to get vote accounts");return r.result}async getSlot(t){let{commitment:e,config:r}=t7(t),n=this._buildArgs([],e,void 0,r),i=C(await this._rpcRequest("getSlot",n),en(N()));if("error"in i)throw new tj(i.error,"failed to get slot");return i.result}async getSlotLeader(t){let{commitment:e,config:r}=t7(t),n=this._buildArgs([],e,void 0,r),i=C(await this._rpcRequest("getSlotLeader",n),en(q()));if("error"in i)throw new tj(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){let r=C(await this._rpcRequest("getSlotLeaders",[t,e]),en(L(t5)));if("error"in r)throw new tj(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){let{context:r,value:n}=await this.getSignatureStatuses([t],e);return tS(1===n.length),{context:r,value:n[0]}}async getSignatureStatuses(t,e){let r=[t];e&&r.push(e);let n=C(await this._rpcRequest("getSignatureStatuses",r),e8);if("error"in n)throw new tj(n.error,"failed to get signature status");return n.result}async getTransactionCount(t){let{commitment:e,config:r}=t7(t),n=this._buildArgs([],e,void 0,r),i=C(await this._rpcRequest("getTransactionCount",n),en(N()));if("error"in i)throw new tj(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){let e=this._buildArgs([],t),r=C(await this._rpcRequest("getInflationGovernor",e),eS);if("error"in r)throw new tj(r.error,"failed to get inflation");return r.result}async getInflationReward(t,e,r){let{commitment:n,config:i}=t7(r),o=this._buildArgs([t.map(t=>t.toBase58())],n,void 0,{...i,epoch:null!=e?e:null==i?void 0:i.epoch}),s=C(await this._rpcRequest("getInflationReward",o),eu);if("error"in s)throw new tj(s.error,"failed to get inflation reward");return s.result}async getInflationRate(){let t=C(await this._rpcRequest("getInflationRate",[]),eE);if("error"in t)throw new tj(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(t){let{commitment:e,config:r}=t7(t),n=this._buildArgs([],e,void 0,r),i=C(await this._rpcRequest("getEpochInfo",n),eA);if("error"in i)throw new tj(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){let t=C(await this._rpcRequest("getEpochSchedule",[]),eI);if("error"in t)throw new tj(t.error,"failed to get epoch schedule");let e=t.result;return new t0(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){let t=C(await this._rpcRequest("getLeaderSchedule",[]),ex);if("error"in t)throw new tj(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){let r=this._buildArgs([t],e),n=C(await this._rpcRequest("getMinimumBalanceForRentExemption",r),e6);return"error"in n?(console.warn("Unable to fetch minimum balance for rent exemption"),0):n.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=C(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),rS);if("error"in e)throw new tj(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){let r=this._buildArgs([t],e),n=C(await this._rpcRequest("getFeeCalculatorForBlockhash",r),rE);if("error"in n)throw new tj(n.error,"failed to get fee calculator");let{context:i,value:o}=n.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){let r=tu(t.serialize()).toString("base64"),n=this._buildArgs([r],e),i=C(await this._rpcRequest("getFeeForMessage",n),ei(z(N())));if("error"in i)throw new tj(i.error,"failed to get fee for message");if(null===i.result)throw Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(t){var e;let r=null==t||null==(e=t.lockedWritableAccounts)?void 0:e.map(t=>t.toBase58()),n=(null==r?void 0:r.length)?[r]:[],i=C(await this._rpcRequest("getRecentPrioritizationFees",n),eM);if("error"in i)throw new tj(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}=t7(t),n=this._buildArgs([],e,void 0,r),i=C(await this._rpcRequest("getLatestBlockhash",n),rv);if("error"in i)throw new tj(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgs([t],r,void 0,n),o=C(await this._rpcRequest("isBlockhashValid",i),rk);if("error"in o)throw new tj(o.error,"failed to determine if the blockhash `"+t+"`is valid");return o.result}async getVersion(){let t=C(await this._rpcRequest("getVersion",[]),en(ey));if("error"in t)throw new tj(t.error,"failed to get version");return t.result}async getGenesisHash(){let t=C(await this._rpcRequest("getGenesisHash",[]),en(q()));if("error"in t)throw new tj(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgsAtLeastConfirmed([t],r,void 0,n),o=await this._rpcRequest("getBlock",i);try{switch(null==n?void 0:n.transactionDetails){case"accounts":{let t=C(o,rf);if("error"in t)throw t.error;return t.result}case"none":{let t=C(o,rh);if("error"in t)throw t.error;return t.result}default:{let t=C(o,rc);if("error"in t)throw t.error;let{result:e}=t;return e?{...e,transactions:e.transactions.map(t=>{let{transaction:e,meta:r,version:n}=t;return{meta:r,transaction:{...e,message:es(n,e.message)},version:n}})}:null}}}catch(t){throw new tj(t,"failed to get confirmed block")}}async getParsedBlock(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",n),o=await this._rpcRequest("getBlock",i);try{switch(null==n?void 0:n.transactionDetails){case"accounts":{let t=C(o,rp);if("error"in t)throw t.error;return t.result}case"none":{let t=C(o,rg);if("error"in t)throw t.error;return t.result}default:{let t=C(o,rd);if("error"in t)throw t.error;return t.result}}}catch(t){throw new tj(t,"failed to get block")}}async getBlockProduction(t){let e,r;if("string"==typeof t)r=t;else if(t){let{commitment:n,...i}=t;r=n,e=i}let n=this._buildArgs([],r,"base64",e),i=C(await this._rpcRequest("getBlockProduction",n),ek);if("error"in i)throw new tj(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgsAtLeastConfirmed([t],r,void 0,n),o=C(await this._rpcRequest("getTransaction",i),rw);if("error"in o)throw new tj(o.error,"failed to get transaction");let s=o.result;return s?{...s,transaction:{...s.transaction,message:es(s.version,s.transaction.message)}}:s}async getParsedTransaction(t,e){let{commitment:r,config:n}=t7(e),i=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",n),o=C(await this._rpcRequest("getTransaction",i),rb);if("error"in o)throw new tj(o.error,"failed to get transaction");return o.result}async getParsedTransactions(t,e){let{commitment:r,config:n}=t7(e),i=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",n)}));return(await this._rpcBatchRequest(i)).map(t=>{let e=C(t,rb);if("error"in e)throw new tj(e.error,"failed to get transactions");return e.result})}async getTransactions(t,e){let{commitment:r,config:n}=t7(e),i=t.map(t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],r,void 0,n)}));return(await this._rpcBatchRequest(i)).map(t=>{let e=C(t,rw);if("error"in e)throw new tj(e.error,"failed to get transactions");let r=e.result;return r?{...r,transaction:{...r.transaction,message:es(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),n=C(await this._rpcRequest("getBlock",r),rm);if("error"in n)throw new tj(n.error,"failed to get confirmed block");let i=n.result;if(!i)throw Error("Confirmed block "+t+" not found");let o={...i,transactions:i.transactions.map(t=>{let{transaction:e,meta:r}=t,n=new tx(e.message);return{meta:r,transaction:{...e,message:n}}})};return{...o,transactions:o.transactions.map(t=>{let{transaction:e,meta:r}=t;return{meta:r,transaction:tP.populate(e.message,e.signatures)}})}}async getBlocks(t,e,r){let n=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],r),i=C(await this._rpcRequest("getBlocks",n),en(L(N())));if("error"in i)throw new tj(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),n=C(await this._rpcRequest("getBlock",r),ry);if("error"in n)throw new tj(n.error,"failed to get block");let i=n.result;if(!i)throw Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),n=C(await this._rpcRequest("getBlock",r),ry);if("error"in n)throw new tj(n.error,"failed to get confirmed block");let i=n.result;if(!i)throw Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),n=C(await this._rpcRequest("getTransaction",r),rw);if("error"in n)throw new tj(n.error,"failed to get transaction");let i=n.result;if(!i)return i;let o=new tx(i.transaction.message),s=i.transaction.signatures;return{...i,transaction:tP.populate(o,s)}}async getParsedConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),n=C(await this._rpcRequest("getTransaction",r),rb);if("error"in n)throw new tj(n.error,"failed to get confirmed transaction");return n.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=C(t,rb);if("error"in e)throw new tj(e.error,"failed to get confirmed transactions");return e.result})}async getConfirmedSignaturesForAddress(t,e,r){let n={},i=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--e<=0)&&!(e<i);)try{let t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(n.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in n)&&!(++r>o);)try{let t=await this.getConfirmedBlockSignatures(r);t.signatures.length>0&&(n.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,n)).map(t=>t.signature)}async getConfirmedSignaturesForAddress2(t,e,r){let n=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),i=C(await this._rpcRequest("getConfirmedSignaturesForAddress2",n),eq);if("error"in i)throw new tj(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,r){let n=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),i=C(await this._rpcRequest("getSignaturesForAddress",n),eD);if("error"in i)throw new tj(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(t,e){let{context:r,value:n}=await this.getAccountInfoAndContext(t,e),i=null;return null!==n&&(i=new t3({key:t,state:t3.deserialize(n.data)})),{context:r,value:i}}async getNonceAndContext(t,e){let{context:r,value:n}=await this.getAccountInfoAndContext(t,e),i=null;return null!==n&&(i=tJ.fromAccountData(n.data)),{context:r,value:i}}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=C(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),rM);if("error"in r)throw new tj(r.error,"airdrop to ".concat(t.toBase58()," failed"));return r.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await tq(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 tq(200)}throw Error("Unable to obtain a new blockhash after ".concat(Date.now()-t,"ms"))}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){let{commitment:e,config:r}=t7(t),n=this._buildArgs([],e,"base64",r),i=C(await this._rpcRequest("getStakeMinimumDelegation",n),ei(N()));if("error"in i)throw new tj(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(t,e,r){let n;if("message"in t){let n=t.serialize(),i=a.Buffer.from(n).toString("base64");if(Array.isArray(e)||void 0!==r)throw Error("Invalid arguments");let o=e||{};o.encoding="base64","commitment"in o||(o.commitment=this.commitment),e&&"object"==typeof e&&"innerInstructions"in e&&(o.innerInstructions=e.innerInstructions);let s=[i,o],u=C(await this._rpcRequest("simulateTransaction",s),ev);if("error"in u)throw Error("failed to simulate transaction: "+u.error.message);return u.result}if(t instanceof tP?((n=new tP).feePayer=t.feePayer,n.instructions=t.instructions,n.nonceInfo=t.nonceInfo,n.signatures=t.signatures):(n=tP.populate(t))._message=n._json=void 0,void 0!==e&&!Array.isArray(e))throw Error("Invalid arguments");if(n.nonceInfo&&e)n.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){let r=await this._blockhashWithExpiryBlockHeight(t);if(n.lastValidBlockHeight=r.lastValidBlockHeight,n.recentBlockhash=r.blockhash,!e)break;if(n.sign(...e),!n.signature)throw Error("!signature");let i=n.signature.toString("base64");if(this._blockhashInfo.simulatedSignatures.includes(i)||this._blockhashInfo.transactionSignatures.includes(i))t=!0;else{this._blockhashInfo.simulatedSignatures.push(i);break}}}let i=n._compile(),o=i.serialize(),s=n._serialize(o).toString("base64"),u={encoding:"base64",commitment:this.commitment};r&&(u.accounts={encoding:"base64",addresses:(Array.isArray(r)?r:i.nonProgramIds()).map(t=>t.toBase58())}),e&&(u.sigVerify=!0),e&&"object"==typeof e&&"innerInstructions"in e&&(u.innerInstructions=e.innerInstructions);let l=[s,u],c=C(await this._rpcRequest("simulateTransaction",l),ev);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 tN({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 n=await this._blockhashWithExpiryBlockHeight(r);if(t.lastValidBlockHeight=n.lastValidBlockHeight,t.recentBlockhash=n.blockhash,t.sign(...e),!t.signature)throw Error("!signature");let i=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(i))r=!0;else{this._blockhashInfo.transactionSignatures.push(i);break}}}let n=t.serialize();return await this.sendRawTransaction(n,r)}async sendRawTransaction(t,e){let r=tu(t).toString("base64");return await this.sendEncodedTransaction(r,e)}async sendEncodedTransaction(t,e){let r={encoding:"base64"},n=e&&e.skipPreflight,i=!0===n?"processed":e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(r.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(r.minContextSlot=e.minContextSlot),n&&(r.skipPreflight=n),i&&(r.preflightCommitment=i);let o=[t,r],s=C(await this._rpcRequest("sendTransaction",o),rA);if("error"in s){let t;throw"data"in s.error&&(t=s.error.data.logs),new tN({action:n?"send":"simulate",signature:"",transactionMessage:s.error.message,logs:t})}return s.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=>{let[e,r]=t;this._setSubscription(e,{...r,state:"pending"})}))}_setSubscription(t,e){var r;let n=null==(r=this._subscriptionsByHash[t])?void 0:r.state;if(this._subscriptionsByHash[t]=e,n!==e.state){let r=this._subscriptionStateChangeCallbacksByHash[t];r&&r.forEach(t=>{try{t(e.state)}catch{}})}}_onSubscriptionStateChange(t,e){var r;let n=this._subscriptionHashByClientSubscriptionId[t];if(null==n)return()=>{};let i=(r=this._subscriptionStateChangeCallbacksByHash)[n]||(r[n]=new Set);return i.add(e),()=>{i.delete(e),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}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: ".concat(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:n,method:i}=r;try{this._setSubscription(t,{...r,state:"subscribing"});let e=await this._rpcWebSocket.call(i,n);this._setSubscription(t,{...r,serverSubscriptionId:e,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[e]=r.callbacks,await this._updateSubscriptions()}catch(o){if(console.error("Received ".concat(o instanceof Error?"":"JSON-RPC ","error calling `").concat(i,"`"),{args:n,error:o}),!e())return;this._setSubscription(t,{...r,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===r.callbacks.size&&await (async()=>{let{serverSubscriptionId:n,unsubscribeMethod:i}=r;if(this._subscriptionsAutoDisposedByRpc.has(n))this._subscriptionsAutoDisposedByRpc.delete(n);else{this._setSubscription(t,{...r,state:"unsubscribing"}),this._setSubscription(t,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[n])}catch(n){if(n instanceof Error&&console.error("".concat(i," error:"),n.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}=C(t,eF);this._handleServerNotification(r,[e.value,e.context])}_makeSubscription(t,e){let r=this._nextClientSubscriptionId++,n=tX([t.method,e]),i=this._subscriptionsByHash[n];return void 0===i?this._subscriptionsByHash[n]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let e=this._subscriptionsByHash[n];tS(void 0!==e,"Could not find a `Subscription` when tearing down client subscription #".concat(r)),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(t,e,r){let{commitment:n,config:i}=t7(r),o=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",i);return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},o)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){let{result:e,subscription:r}=C(t,eV);this._handleServerNotification(r,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,r,n){let{commitment:i,config:o}=t7(r),s=this._buildArgs([t.toBase58()],i||this._commitment||"finalized","base64",o||(n?{filters:et(n)}:void 0));return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,r){let n=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],r||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){let{result:e,subscription:r}=C(t,rx);this._handleServerNotification(r,[e.value,e.context])}_wsOnSlotNotification(t){let{result:e,subscription:r}=C(t,eY);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}=C(t,eG);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 "+"`".concat(t,"` for '").concat(e,"' events ")+"could not be found.")}_buildArgs(t,e,r,n){let i=e||this._commitment;if(i||r||n){let e={};r&&(e.encoding=r),i&&(e.commitment=i),n&&(e=Object.assign(e,n)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,r,n){let i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,r,n)}_wsOnSignatureNotification(t){let{result:e,subscription:r}=C(t,eQ);"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 n=this._buildArgs([t],r||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,r)=>{if("status"===t.type){e(t.result,r);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return i}onSignatureWithOptions(t,e,r){let{commitment:n,...i}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},o=this._buildArgs([t],n,void 0,i),s=this._makeSubscription({callback:(t,r)=>{e(t,r);try{this.removeSignatureListener(s)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){let{result:e,subscription:r}=C(t,eX);this._handleServerNotification(r,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}constructor(t,e){var r;let n,i,o,s,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=>{var r;let{commitment:n,config:i}=t7(e),o=this._buildArgs([],n,void 0,i),s=tX(o);return t[s]=null!=(r=t[s])?r:(async()=>{try{let t=await this._rpcRequest("getBlockHeight",o),e=C(t,en(N()));if("error"in e)throw new tj(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,n=e.wsEndpoint,i=e.httpHeaders,o=e.fetch,s=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=n||function(t){let e=t.match(t6);if(null==e)throw TypeError("Failed to validate endpoint URL `".concat(t,"`"));let[r,n,i,o]=e,s=t.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return"".concat(s,"//").concat(n).concat(null==a?"":":".concat(a+1)).concat(o)}(t),this._rpcClient=function(t,e,r,n,i,o){let s,a,u=r||t1;return null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),n&&(a=async(t,e)=>{let r=await new Promise((r,i)=>{try{n(t,e,(t,e)=>r([t,e]))}catch(t){i(t)}});return await u(...r)}),new(Z())(async(r,n)=>{let o={method:"POST",body:r,agent:s,headers:Object.assign({"Content-Type":"application/json"},e||{},r_)};try{let e,r=5,s=500;for(;(e=a?await a(t,o):await u(t,o),429===e.status&&!0!==i)&&(r-=1,0!==r);){;console.error("Server responded with ".concat(e.status," ").concat(e.statusText,". Retrying after ").concat(s,"ms delay...")),await tq(s),s*=2}let l=await e.text();e.ok?n(null,l):n(Error("".concat(e.status," ").concat(e.statusText,": ").concat(l)))}catch(t){t instanceof Error&&n(t)}},{})}(t,i,o,s,a,u),this._rpcRequest=(r=this._rpcClient,(t,e)=>new Promise((n,i)=>{r.request(t,e,(t,e)=>{t?i(t):n(e)})})),this._rpcBatchRequest=function(t){return e=>new Promise((r,n)=>{0===e.length&&r([]);let i=e.map(e=>t.request(e.methodName,e.args));t.request(i,(t,e)=>{t?n(t):r(e)})})}(this._rpcClient),this._rpcWebSocket=new t2(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))}}class rT{static generate(){return new rT(tn())}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=ti(t.slice(0,32));for(let t=0;t<32;t++)if(r[t]!==e[t])throw Error("provided secretKey is invalid")}return new rT({publicKey:r,secretKey:t})}static fromSeed(t){let e=ti(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),new rT({publicKey:e,secretKey:r})}get publicKey(){return new tf(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}constructor(t){this._keypair=void 0,this._keypair=null!=t?t:tn()}}Object.freeze({CreateLookupTable:{index:0,layout:g.struct([g.u32("instruction"),tY("recentSlot"),g.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:g.struct([g.u32("instruction")])},ExtendLookupTable:{index:2,layout:g.struct([g.u32("instruction"),tY(),g.seq(ty(),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 tf("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"),tY("microLamports")])}}),new tf("ComputeBudget111111111111111111111111111111");let rC=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 rR{static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:n,instructionIndex:i}=t;tS(32===e.length,"Public Key must be ".concat(32," bytes but received ").concat(e.length," bytes")),tS(64===n.length,"Signature must be ".concat(64," bytes but received ").concat(n.length," bytes"));let o=rC.span,s=o+e.length,u=s+n.length,l=a.Buffer.alloc(u+r.length),c=null==i?65535:i;return rC.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:c,publicKeyOffset:o,publicKeyInstructionIndex:c,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:c},l),l.fill(e,o),l.fill(n,s),l.fill(r,u),new tR({keys:[],programId:rR.programId,data:l})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:n}=t;tS(64===e.length,"Private key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{let t=rT.fromSecretKey(e),i=t.publicKey.toBytes(),o=ts(r,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:r,signature:o,instructionIndex:n})}catch(t){throw Error("Error creating instruction; ".concat(t))}}constructor(){}}rR.programId=new tf("Ed25519SigVerify111111111111111111111111111"),tr.bI.utils.isValidPrivateKey;let rP=tr.bI.getPublicKey,rL=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 rU{static publicKeyToEthAddress(t){tS(64===t.length,"Public key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{return a.Buffer.from((0,te.lY)(tu(t))).slice(-20)}catch(t){throw Error("Error constructing Ethereum address: ".concat(t))}}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:n,recoveryId:i,instructionIndex:o}=t;return rU.createInstructionWithEthAddress({ethAddress:rU.publicKeyToEthAddress(e),message:r,signature:n,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){let e,{ethAddress:r,message:n,signature:i,recoveryId:o,instructionIndex:s=0}=t;tS(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 ".concat(20," bytes but received ").concat(e.length," bytes"));let u=12+e.length,l=u+i.length+1,c=a.Buffer.alloc(rL.span+n.length);return rL.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:l,messageDataSize:n.length,messageInstructionIndex:s,signature:tu(i),ethAddress:tu(e),recoveryId:o},c),c.fill(tu(n),rL.span),new tR({keys:[],programId:rU.programId,data:c})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:n}=t;tS(32===e.length,"Private key must be ".concat(32," bytes but received ").concat(e.length," bytes"));try{var i;let t,o=tu(e),s=rP(o,!1).slice(1),[u,l]=(i=a.Buffer.from((0,te.lY)(tu(r))),[(t=tr.bI.sign(i,o)).toCompactRawBytes(),t.recovery]);return this.createInstructionWithPublicKey({publicKey:s,message:r,signature:u,recoveryId:l,instructionIndex:n})}catch(t){throw Error("Error creating instruction; ".concat(t))}}constructor(){}}rU.programId=new tf("KeccakSecp256k11111111111111111111111111111");let rO=new tf("StakeConfig11111111111111111111111111111111");class rW{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}}rW.default=new rW(0,0,tf.default);let rz=Object.freeze({Initialize:{index:0,layout:g.struct([g.u32("instruction"),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return g.struct([ty("staker"),ty("withdrawer")],t)}(),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return g.struct([g.ns64("unixTimestamp"),g.ns64("epoch"),ty("custodian")],t)}()])},Authorize:{index:1,layout:g.struct([g.u32("instruction"),ty("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"),ty("newAuthorized"),g.u32("stakeAuthorizationType"),tb("authoritySeed"),ty("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class rN{static initialize(t){let{stakePubkey:e,authorized:r,lockup:n}=t,i=n||rW.default,o=tD(rz.Initialize,{authorized:{staker:tu(r.staker.toBuffer()),withdrawer:tu(r.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:tu(i.custodian.toBuffer())}});return new tR({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tW,isSigner:!1,isWritable:!1}],programId:this.programId,data:o})}static createAccountWithSeed(t){let e=new tP;e.add(tG.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:n,lockup:i}=t;return e.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static createAccount(t){let e=new tP;e.add(tG.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:n,lockup:i}=t;return e.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:r,votePubkey:n}=t,i=tD(rz.Delegate);return new tP().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:tz,isSigner:!1,isWritable:!1},{pubkey:rO,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){let{stakePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:i,custodianPubkey:o}=t,s=tD(rz.Authorize,{newAuthorized:tu(n.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tU,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),new tP().add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:r,authoritySeed:n,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=t,u=tD(rz.AuthorizeWithSeed,{newAuthorized:tu(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:n,authorityOwner:tu(i.toBuffer())}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:tU,isSigner:!1,isWritable:!1}];return a&&l.push({pubkey:a,isSigner:!0,isWritable:!1}),new tP().add({keys:l,programId:this.programId,data:u})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:r,splitStakePubkey:n,lamports:i}=t,o=tD(rz.Split,{lamports:i});return new tR({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t,e){let r=new tP;return r.add(tG.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:n,splitStakePubkey:i,basePubkey:o,seed:s,lamports:a}=t,u=new tP;return u.add(tG.allocate({accountPubkey:i,basePubkey:o,seed:s,space:this.space,programId:this.programId})),e&&e>0&&u.add(tG.transfer({fromPubkey:t.authorizedPubkey,toPubkey:i,lamports:e})),u.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,lamports:a}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:r,authorizedPubkey:n}=t,i=tD(rz.Merge);return new tP().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:tz,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:r,toPubkey:n,lamports:i,custodianPubkey:o}=t,s=tD(rz.Withdraw,{lamports:i}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:tz,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),new tP().add({keys:a,programId:this.programId,data:s})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:r}=t,n=tD(rz.Deactivate);return new tP().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}constructor(){}}rN.programId=new tf("Stake11111111111111111111111111111111111111"),rN.space=200;let rj=Object.freeze({InitializeAccount:{index:0,layout:g.struct([g.u32("instruction"),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return g.struct([ty("nodePubkey"),ty("authorizedVoter"),ty("authorizedWithdrawer"),g.u8("commission")],t)}()])},Authorize:{index:1,layout:g.struct([g.u32("instruction"),ty("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"),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return g.struct([g.u32("voteAuthorizationType"),ty("currentAuthorityDerivedKeyOwnerPubkey"),tb("currentAuthorityDerivedKeySeed"),ty("newAuthorized")],t)}()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class rK{static initializeAccount(t){let{votePubkey:e,nodePubkey:r,voteInit:n}=t,i=tD(rj.InitializeAccount,{voteInit:{nodePubkey:tu(n.nodePubkey.toBuffer()),authorizedVoter:tu(n.authorizedVoter.toBuffer()),authorizedWithdrawer:tu(n.authorizedWithdrawer.toBuffer()),commission:n.commission}});return new tR({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tW,isSigner:!1,isWritable:!1},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static createAccount(t){let e=new tP;return e.add(tG.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:n,voteAuthorizationType:i}=t,o=tD(rj.Authorize,{newAuthorized:tu(n.toBuffer()),voteAuthorizationType:i.index});return new tP().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=t,a=tD(rj.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:tu(r.toBuffer()),currentAuthorityDerivedKeySeed:n,newAuthorized:tu(i.toBuffer()),voteAuthorizationType:o.index}});return new tP().add({keys:[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:tU,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,lamports:n,toPubkey:i}=t,o=tD(rj.Withdraw,{lamports:n});return new tP().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static safeWithdraw(t,e,r){if(t.lamports>e-r)throw Error("Withdraw will leave vote account with insufficient funds.");return rK.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,nodePubkey:n}=t,i=tD(rj.UpdateValidatorIdentity);return new tP().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}constructor(){}}rK.programId=new tf("Vote111111111111111111111111111111111111111"),rK.space=3762,new tf("Va1idator1nfo111111111111111111111111111111"),F({name:q(),website:j(q()),details:j(q()),iconUrl:j(q()),keybaseUsername:j(q())}),new tf("Vote111111111111111111111111111111111111111"),g.struct([ty("nodePubkey"),ty("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"),ty("authorizedVoter")]),g.offset(g.u32(),-8),"authorizedVoters"),g.struct([g.seq(g.struct([ty("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")])},99948:function(t,e,r){t=r.nmd(t),r(98114),r(22501),r(58910),r(19161),r(6560),r(50036),r(59781),function(t,e){"use strict";function n(t,e){if(!t)throw Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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=o:e.BN=o,o.BN=o,o.wordSize=26;try{h="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(53112).Buffer}catch(t){}function s(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 n(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u<a;u++){var l=t.charCodeAt(u)-48;o*=i,s=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s<i,"Invalid character"),o+=s}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return 0>t.cmp(e)?t:e},o.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),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.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):(n(t<0x20000000000000),this.words=[0x3ffffff&t,t/0x4000000&0x3ffffff,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("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 i,o,s=0;s<this.length;s++)this.words[s]=0;var a=0;if("be"===r)for(s=t.length-1,i=0;s>=0;s-=3)o=t[s]|t[s-1]<<8|t[s-2]<<16,this.words[i]|=o<<a&0x3ffffff,this.words[i+1]=o>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,i++);else if("le"===r)for(s=0,i=0;s<t.length;s+=3)o=t[s]|t[s+1]<<8|t[s+2]<<16,this.words[i]|=o<<a&0x3ffffff,this.words[i+1]=o>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,i++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var n,i=0;i<this.length;i++)this.words[i]=0;var o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=0x3ffffff&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=0x3ffffff&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=0x3ffffff;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,l=0,c=r;c<a;c+=n)l=u(t,c,c+n,e),this.imuln(i),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==s){var h=1;for(l=u(t,c,t.length,e),c=0;c<s;c++)h*=e;this.imuln(h),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this._strip()},o.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},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.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 n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=0x3ffffff&s,u=s/0x4000000|0;r.words[0]=a;for(var l=1;l<n;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+=(s=(i=0|t.words[p])*(o=0|e.words[d])+h)/0x4000000|0,h=0x3ffffff&s}r.words[l]=0|h,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){for(var r="",i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=((a<<i|o)&0xffffff).toString(16);o=a>>>24-i&0xffffff,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.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}n(!1,"Base should be between 2 and 36")},o.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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},h&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(h,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=t.allocUnsafe?t.allocUnsafe(o):new t(o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},o.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},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.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()},o.prototype.ior=function(t){return n((this.negative|t.negative)==0),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.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()},o.prototype.iand=function(t){return n((this.negative|t.negative)==0),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n((this.negative|t.negative)==0),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=0x3ffffff&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&0x3ffffff>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),e?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this._strip()},o.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,n=t):(r=t,n=this);for(var e,r,n,i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=0x3ffffff&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=0x3ffffff&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.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)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(e=this,r=t):(e=t,r=this);for(var o=0,s=0;s<r.length;s++)o=(n=(0|e.words[s])-(0|r.words[s])+o)>>26,this.words[s]=0x3ffffff&n;for(;0!==o&&s<e.length;s++)o=(n=(0|e.words[s])+o)>>26,this.words[s]=0x3ffffff&n;if(0===o&&s<e.length&&e!==this)for(;s<e.length;s++)this.words[s]=e.words[s];return this.length=Math.max(this.length,s),e!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,l=0,c=0|s[0],h=8191&c,f=c>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,b=0|s[3],v=8191&b,k=b>>>13,S=0|s[4],E=8191&S,M=S>>>13,A=0|s[5],I=8191&A,x=A>>>13,_=0|s[6],B=8191&_,T=_>>>13,C=0|s[7],R=8191&C,P=C>>>13,L=0|s[8],U=8191&L,O=L>>>13,W=0|s[9],z=8191&W,N=W>>>13,j=0|a[0],K=8191&j,q=j>>>13,D=0|a[1],F=8191&D,H=D>>>13,V=0|a[2],J=8191&V,Y=V>>>13,Z=0|a[3],G=8191&Z,Q=Z>>>13,X=0|a[4],$=8191&X,tt=X>>>13,te=0|a[5],tr=8191&te,tn=te>>>13,ti=0|a[6],to=8191&ti,ts=ti>>>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,n=Math.imul(h,K);var tm=(l+n|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(f,K)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(tm>>>26)|0,tm&=0x3ffffff,n=Math.imul(p,K),i=(i=Math.imul(p,q))+Math.imul(g,K)|0,o=Math.imul(g,q),n=n+Math.imul(h,F)|0;var ty=(l+n|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(f,F)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(ty>>>26)|0,ty&=0x3ffffff,n=Math.imul(y,K),i=(i=Math.imul(y,q))+Math.imul(w,K)|0,o=Math.imul(w,q),n=n+Math.imul(p,F)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,H)|0,n=n+Math.imul(h,J)|0;var tw=(l+n|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(tw>>>26)|0,tw&=0x3ffffff,n=Math.imul(v,K),i=(i=Math.imul(v,q))+Math.imul(k,K)|0,o=Math.imul(k,q),n=n+Math.imul(y,F)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,H)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,J)|0,o=o+Math.imul(g,Y)|0,n=n+Math.imul(h,G)|0;var tb=(l+n|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(f,G)|0))<<13)|0;l=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(tb>>>26)|0,tb&=0x3ffffff,n=Math.imul(E,K),i=(i=Math.imul(E,q))+Math.imul(M,K)|0,o=Math.imul(M,q),n=n+Math.imul(v,F)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,Q)|0,n=n+Math.imul(h,$)|0;var tv=(l+n|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(tv>>>26)|0,tv&=0x3ffffff,n=Math.imul(I,K),i=(i=Math.imul(I,q))+Math.imul(x,K)|0,o=Math.imul(x,q),n=n+Math.imul(E,F)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0,n=n+Math.imul(h,tr)|0;var tk=(l+n|0)+((8191&(i=(i=i+Math.imul(h,tn)|0)+Math.imul(f,tr)|0))<<13)|0;l=((o=o+Math.imul(f,tn)|0)+(i>>>13)|0)+(tk>>>26)|0,tk&=0x3ffffff,n=Math.imul(B,K),i=(i=Math.imul(B,q))+Math.imul(T,K)|0,o=Math.imul(T,q),n=n+Math.imul(I,F)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(v,G)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,tr)|0,i=(i=i+Math.imul(p,tn)|0)+Math.imul(g,tr)|0,o=o+Math.imul(g,tn)|0,n=n+Math.imul(h,to)|0;var tS=(l+n|0)+((8191&(i=(i=i+Math.imul(h,ts)|0)+Math.imul(f,to)|0))<<13)|0;l=((o=o+Math.imul(f,ts)|0)+(i>>>13)|0)+(tS>>>26)|0,tS&=0x3ffffff,n=Math.imul(R,K),i=(i=Math.imul(R,q))+Math.imul(P,K)|0,o=Math.imul(P,q),n=n+Math.imul(B,F)|0,i=(i=i+Math.imul(B,H)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(E,G)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(y,tr)|0,i=(i=i+Math.imul(y,tn)|0)+Math.imul(w,tr)|0,o=o+Math.imul(w,tn)|0,n=n+Math.imul(p,to)|0,i=(i=i+Math.imul(p,ts)|0)+Math.imul(g,to)|0,o=o+Math.imul(g,ts)|0,n=n+Math.imul(h,tu)|0;var tE=(l+n|0)+((8191&(i=(i=i+Math.imul(h,tl)|0)+Math.imul(f,tu)|0))<<13)|0;l=((o=o+Math.imul(f,tl)|0)+(i>>>13)|0)+(tE>>>26)|0,tE&=0x3ffffff,n=Math.imul(U,K),i=(i=Math.imul(U,q))+Math.imul(O,K)|0,o=Math.imul(O,q),n=n+Math.imul(R,F)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,Q)|0,n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(v,tr)|0,i=(i=i+Math.imul(v,tn)|0)+Math.imul(k,tr)|0,o=o+Math.imul(k,tn)|0,n=n+Math.imul(y,to)|0,i=(i=i+Math.imul(y,ts)|0)+Math.imul(w,to)|0,o=o+Math.imul(w,ts)|0,n=n+Math.imul(p,tu)|0,i=(i=i+Math.imul(p,tl)|0)+Math.imul(g,tu)|0,o=o+Math.imul(g,tl)|0,n=n+Math.imul(h,th)|0;var tM=(l+n|0)+((8191&(i=(i=i+Math.imul(h,tf)|0)+Math.imul(f,th)|0))<<13)|0;l=((o=o+Math.imul(f,tf)|0)+(i>>>13)|0)+(tM>>>26)|0,tM&=0x3ffffff,n=Math.imul(z,K),i=(i=Math.imul(z,q))+Math.imul(N,K)|0,o=Math.imul(N,q),n=n+Math.imul(U,F)|0,i=(i=i+Math.imul(U,H)|0)+Math.imul(O,F)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,Q)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(E,tr)|0,i=(i=i+Math.imul(E,tn)|0)+Math.imul(M,tr)|0,o=o+Math.imul(M,tn)|0,n=n+Math.imul(v,to)|0,i=(i=i+Math.imul(v,ts)|0)+Math.imul(k,to)|0,o=o+Math.imul(k,ts)|0,n=n+Math.imul(y,tu)|0,i=(i=i+Math.imul(y,tl)|0)+Math.imul(w,tu)|0,o=o+Math.imul(w,tl)|0,n=n+Math.imul(p,th)|0,i=(i=i+Math.imul(p,tf)|0)+Math.imul(g,th)|0,o=o+Math.imul(g,tf)|0,n=n+Math.imul(h,tp)|0;var tA=(l+n|0)+((8191&(i=(i=i+Math.imul(h,tg)|0)+Math.imul(f,tp)|0))<<13)|0;l=((o=o+Math.imul(f,tg)|0)+(i>>>13)|0)+(tA>>>26)|0,tA&=0x3ffffff,n=Math.imul(z,F),i=(i=Math.imul(z,H))+Math.imul(N,F)|0,o=Math.imul(N,H),n=n+Math.imul(U,J)|0,i=(i=i+Math.imul(U,Y)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,Q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,Q)|0,n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,tr)|0,i=(i=i+Math.imul(I,tn)|0)+Math.imul(x,tr)|0,o=o+Math.imul(x,tn)|0,n=n+Math.imul(E,to)|0,i=(i=i+Math.imul(E,ts)|0)+Math.imul(M,to)|0,o=o+Math.imul(M,ts)|0,n=n+Math.imul(v,tu)|0,i=(i=i+Math.imul(v,tl)|0)+Math.imul(k,tu)|0,o=o+Math.imul(k,tl)|0,n=n+Math.imul(y,th)|0,i=(i=i+Math.imul(y,tf)|0)+Math.imul(w,th)|0,o=o+Math.imul(w,tf)|0,n=n+Math.imul(p,tp)|0;var tI=(l+n|0)+((8191&(i=(i=i+Math.imul(p,tg)|0)+Math.imul(g,tp)|0))<<13)|0;l=((o=o+Math.imul(g,tg)|0)+(i>>>13)|0)+(tI>>>26)|0,tI&=0x3ffffff,n=Math.imul(z,J),i=(i=Math.imul(z,Y))+Math.imul(N,J)|0,o=Math.imul(N,Y),n=n+Math.imul(U,G)|0,i=(i=i+Math.imul(U,Q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,Q)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(B,tr)|0,i=(i=i+Math.imul(B,tn)|0)+Math.imul(T,tr)|0,o=o+Math.imul(T,tn)|0,n=n+Math.imul(I,to)|0,i=(i=i+Math.imul(I,ts)|0)+Math.imul(x,to)|0,o=o+Math.imul(x,ts)|0,n=n+Math.imul(E,tu)|0,i=(i=i+Math.imul(E,tl)|0)+Math.imul(M,tu)|0,o=o+Math.imul(M,tl)|0,n=n+Math.imul(v,th)|0,i=(i=i+Math.imul(v,tf)|0)+Math.imul(k,th)|0,o=o+Math.imul(k,tf)|0,n=n+Math.imul(y,tp)|0;var tx=(l+n|0)+((8191&(i=(i=i+Math.imul(y,tg)|0)+Math.imul(w,tp)|0))<<13)|0;l=((o=o+Math.imul(w,tg)|0)+(i>>>13)|0)+(tx>>>26)|0,tx&=0x3ffffff,n=Math.imul(z,G),i=(i=Math.imul(z,Q))+Math.imul(N,G)|0,o=Math.imul(N,Q),n=n+Math.imul(U,$)|0,i=(i=i+Math.imul(U,tt)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(R,tr)|0,i=(i=i+Math.imul(R,tn)|0)+Math.imul(P,tr)|0,o=o+Math.imul(P,tn)|0,n=n+Math.imul(B,to)|0,i=(i=i+Math.imul(B,ts)|0)+Math.imul(T,to)|0,o=o+Math.imul(T,ts)|0,n=n+Math.imul(I,tu)|0,i=(i=i+Math.imul(I,tl)|0)+Math.imul(x,tu)|0,o=o+Math.imul(x,tl)|0,n=n+Math.imul(E,th)|0,i=(i=i+Math.imul(E,tf)|0)+Math.imul(M,th)|0,o=o+Math.imul(M,tf)|0,n=n+Math.imul(v,tp)|0;var t_=(l+n|0)+((8191&(i=(i=i+Math.imul(v,tg)|0)+Math.imul(k,tp)|0))<<13)|0;l=((o=o+Math.imul(k,tg)|0)+(i>>>13)|0)+(t_>>>26)|0,t_&=0x3ffffff,n=Math.imul(z,$),i=(i=Math.imul(z,tt))+Math.imul(N,$)|0,o=Math.imul(N,tt),n=n+Math.imul(U,tr)|0,i=(i=i+Math.imul(U,tn)|0)+Math.imul(O,tr)|0,o=o+Math.imul(O,tn)|0,n=n+Math.imul(R,to)|0,i=(i=i+Math.imul(R,ts)|0)+Math.imul(P,to)|0,o=o+Math.imul(P,ts)|0,n=n+Math.imul(B,tu)|0,i=(i=i+Math.imul(B,tl)|0)+Math.imul(T,tu)|0,o=o+Math.imul(T,tl)|0,n=n+Math.imul(I,th)|0,i=(i=i+Math.imul(I,tf)|0)+Math.imul(x,th)|0,o=o+Math.imul(x,tf)|0,n=n+Math.imul(E,tp)|0;var tB=(l+n|0)+((8191&(i=(i=i+Math.imul(E,tg)|0)+Math.imul(M,tp)|0))<<13)|0;l=((o=o+Math.imul(M,tg)|0)+(i>>>13)|0)+(tB>>>26)|0,tB&=0x3ffffff,n=Math.imul(z,tr),i=(i=Math.imul(z,tn))+Math.imul(N,tr)|0,o=Math.imul(N,tn),n=n+Math.imul(U,to)|0,i=(i=i+Math.imul(U,ts)|0)+Math.imul(O,to)|0,o=o+Math.imul(O,ts)|0,n=n+Math.imul(R,tu)|0,i=(i=i+Math.imul(R,tl)|0)+Math.imul(P,tu)|0,o=o+Math.imul(P,tl)|0,n=n+Math.imul(B,th)|0,i=(i=i+Math.imul(B,tf)|0)+Math.imul(T,th)|0,o=o+Math.imul(T,tf)|0,n=n+Math.imul(I,tp)|0;var tT=(l+n|0)+((8191&(i=(i=i+Math.imul(I,tg)|0)+Math.imul(x,tp)|0))<<13)|0;l=((o=o+Math.imul(x,tg)|0)+(i>>>13)|0)+(tT>>>26)|0,tT&=0x3ffffff,n=Math.imul(z,to),i=(i=Math.imul(z,ts))+Math.imul(N,to)|0,o=Math.imul(N,ts),n=n+Math.imul(U,tu)|0,i=(i=i+Math.imul(U,tl)|0)+Math.imul(O,tu)|0,o=o+Math.imul(O,tl)|0,n=n+Math.imul(R,th)|0,i=(i=i+Math.imul(R,tf)|0)+Math.imul(P,th)|0,o=o+Math.imul(P,tf)|0,n=n+Math.imul(B,tp)|0;var tC=(l+n|0)+((8191&(i=(i=i+Math.imul(B,tg)|0)+Math.imul(T,tp)|0))<<13)|0;l=((o=o+Math.imul(T,tg)|0)+(i>>>13)|0)+(tC>>>26)|0,tC&=0x3ffffff,n=Math.imul(z,tu),i=(i=Math.imul(z,tl))+Math.imul(N,tu)|0,o=Math.imul(N,tl),n=n+Math.imul(U,th)|0,i=(i=i+Math.imul(U,tf)|0)+Math.imul(O,th)|0,o=o+Math.imul(O,tf)|0,n=n+Math.imul(R,tp)|0;var tR=(l+n|0)+((8191&(i=(i=i+Math.imul(R,tg)|0)+Math.imul(P,tp)|0))<<13)|0;l=((o=o+Math.imul(P,tg)|0)+(i>>>13)|0)+(tR>>>26)|0,tR&=0x3ffffff,n=Math.imul(z,th),i=(i=Math.imul(z,tf))+Math.imul(N,th)|0,o=Math.imul(N,tf),n=n+Math.imul(U,tp)|0;var tP=(l+n|0)+((8191&(i=(i=i+Math.imul(U,tg)|0)+Math.imul(O,tp)|0))<<13)|0;l=((o=o+Math.imul(O,tg)|0)+(i>>>13)|0)+(tP>>>26)|0,tP&=0x3ffffff,n=Math.imul(z,tp);var tL=(l+n|0)+((8191&(i=(i=Math.imul(z,tg))+Math.imul(N,tp)|0))<<13)|0;return l=((o=Math.imul(N,tg))+(i>>>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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=0x3ffffff&n,u=Math.min(o,e.length-1),l=Math.max(0,o-t.length+1);l<=u;l++){var c=o-l,h=(0|t.words[c])*(0|e.words[l]),f=0x3ffffff&h;s=s+(h/0x4000000|0)|0,a=0x3ffffff&(f=f+a|0),i+=(s=s+(f>>>26)|0)>>>26,s&=0x3ffffff}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function w(t,e){this.x=t,this.y=e}Math.imul||(m=g),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return 10===this.length&&10===t.length?r=m(this,t,e):n<63?r=g(this,t,e):r=y(this,t,e),r},w.prototype.makeRBT=function(t){for(var e=Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},w.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},w.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},w.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),c=0;c<i;c+=a)for(var h=u,f=l,d=0;d<s;d++){var p=r[c+d],g=n[c+d],m=r[c+d+s],y=n[c+d+s],w=h*m-f*y;y=h*y+f*m,m=w,r[c+d]=p+m,n[c+d]=g+y,r[c+d+s]=p-m,n[c+d+s]=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),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},w.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},w.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=0x3ffffff&i,r=i<0x4000000?0:i/0x4000000|0}return t},w.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n((-8192&o)==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 n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=Array(n),a=Array(n),u=Array(n),l=Array(n),c=Array(n),h=Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,l,n),this.transform(s,o,a,u,n,i),this.transform(l,o,c,h,n,i);for(var d=0;d<n;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,n),this.transform(a,u,f,o,n,i),this.conjugate(f,o,n),this.normalize13b(f,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<0x4000000);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(0x3ffffff&o)+(0x3ffffff&r);r>>=26,r+=(o/0x4000000|0)+(s>>>26),this.words[i]=0x3ffffff&s}return 0!==r&&(this.words[i]=r,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=0x3ffffff>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){n("number"==typeof t&&t>=0);var i=e?(e-e%26)/26:0,o=t%26,s=Math.min((t-o)/26,this.length),a=0x3ffffff^0x3ffffff>>>o<<o;if(i-=s,i=Math.max(0,i),r){for(var u=0;u<s;u++)r.words[u]=this.words[u];r.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return!(this.length<=r)&&!!(this.words[r]&1<<e)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return(n(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())},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return(n("number"==typeof t),n(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)},o.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},o.prototype.isubn=function(t){if(n("number"==typeof t),n(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()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;o-=0x3ffffff&u,a=(o>>26)-(u/0x4000000|0),this.words[i+r]=0x3ffffff&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=0x3ffffff&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=0x3ffffff&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r,n=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1];0!=(n=26-this._countBits(a))&&(s=s.ushln(n),i.iushln(n),a=0|s.words[s.length-1]);var u=i.length-s.length;if("mod"!==e){(r=new o(null)).length=u+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var c=i.clone()._ishlnsubmul(s,1,u);0===c.negative&&(i=c,r&&(r.words[u]=1));for(var h=u-1;h>=0;h--){var f=(0|i.words[s.length+h])*0x4000000+(0|i.words[s.length+h-1]);for(f=Math.min(f/a|0,0x3ffffff),i._ishlnsubmul(s,f,h);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(s,1,h),i.isZero()||(i.negative^=1);r&&(r.words[h]=f)}return r&&r._strip(),i._strip(),"div"!==e&&0!==n&&i.iushrn(n),{div:r||null,mod:i}},o.prototype.divmod=function(t,e,r){var i,s,a;return(n(!t.isZero()),this.isZero())?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):(this.negative&t.negative)!=0?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||0>this.cmp(t)?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=0x3ffffff);for(var r=0x4000000%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=0x3ffffff);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+0x4000000*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(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;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(h)),i.iushrn(1),s.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),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e,r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var s=new o(1),a=new o(0),u=i.clone();r.cmpn(1)>0&&i.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;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,f=1;(i.words[0]&f)==0&&h<26;++h,f<<=1);if(h>0)for(i.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(a)):(i.isub(r),a.isub(s))}return 0>(e=0===r.cmpn(1)?s:a).cmpn(0)&&e.iadd(t),e},o.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 n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return(1&this.words[0])==0},o.prototype.isOdd=function(){return(1&this.words[0])==1},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];a+=o,o=a>>>26,a&=0x3ffffff,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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),n(t<=0x3ffffff,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.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},o.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return -1===this.cmpn(t)},o.prototype.lt=function(t){return -1===this.cmp(t)},o.prototype.lten=function(t){return 0>=this.cmpn(t)},o.prototype.lte=function(t){return 0>=this.cmp(t)},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(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 o(e,16),this.n=this.p.bitLength(),this.k=new o(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=o._prime(t);this.m=e.p,this.prime=e}else n(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 o(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 o(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 n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(k,v),k.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9){t.words[0]=0,t.length=1;return}var i=t.words[9];for(n=10,e.words[e.length++]=4194303&i;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&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 n=0|t.words[r];e+=977*n,t.words[r]=0x3ffffff&e,e=64*n+(e/0x4000000|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(S,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=(0|t.words[r])*19+e,i=0x3ffffff&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._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){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n((t.negative|e.negative)==0,"red works only with positives"),n(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(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(h,new o(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 o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var l=e.words[n],c=u-1;c>=0;c--){var h=l>>c&1;if(i!==r[0]&&(i=this.sqr(i)),0===h&&0===s){a=0;continue}s<<=1,s|=h,(4==++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)}u=26}return i},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},o.mont=function(t){return new I(t)},i(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),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):0>i.cmpn(0)&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)},58866:function(t,e,r){"use strict";r(43510),r(98114),r(19161),r(6560),r(50036),r(88711),r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(10676),r(41730),r(22239);var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__decorate||function(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s},s=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)&&n(e,t,r);return i(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(99948)),l=a(r(46846)),c=s(r(62614)),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{addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}}e.BorshError=f;class d{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)}constructor(){this.buf=Buffer.alloc(1024),this.length=0}}function p(t,e,r){let n=r.value;r.value=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];try{return n.apply(this,e)}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{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 ".concat(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: ".concat(t))}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),r=[];for(let n=0;n<e;++n)r.push(t());return r}constructor(t){this.buf=t,this.offset=0}}function m(t){return t.charAt(0).toUpperCase()+t.slice(1)}function y(t,e,r,n,i){try{if("string"==typeof n)i["write".concat(m(n))](r);else if(n instanceof Array)if("number"==typeof n[0]){if(r.length!==n[0])throw new f("Expecting byte array of length ".concat(n[0],", but got ").concat(r.length," bytes"));i.writeFixedArray(r)}else if(2===n.length&&"number"==typeof n[1]){if(r.length!==n[1])throw new f("Expecting byte array of length ".concat(n[1],", but got ").concat(r.length," bytes"));for(let e=0;e<n[1];e++)y(t,null,r[e],n[0],i)}else i.writeArray(r,r=>{y(t,e,r,n[0],i)});else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),y(t,e,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,o)=>{y(t,e,o,n.key,i),y(t,e,r,n.value,i)});break;default:throw new f("FieldType ".concat(n," unrecognized"))}else w(t,r,i)}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 n=t.get(e.constructor);if(!n)throw new f("Class ".concat(e.constructor.name," is missing in schema"));if("struct"===n.kind)n.fields.map(n=>{let[i,o]=n;y(t,i,e[i],o,r)});else if("enum"===n.kind){let i=e[n.field];for(let o=0;o<n.values.length;++o){let[s,a]=n.values[o];if(s===i){r.writeU8(o),y(t,s,e[s],a,r);break}}}else throw new f("Unexpected schema kind: ".concat(n.kind," for ").concat(e.constructor.name))}function b(t,e,r,n){try{if("string"==typeof r)return n["read".concat(m(r))]();if(r instanceof Array)if("number"==typeof r[0])return n.readFixedArray(r[0]);else{if("number"!=typeof r[1])return n.readArray(()=>b(t,e,r[0],n));let i=[];for(let e=0;e<r[1];e++)i.push(b(t,null,r[0],n));return i}if("option"===r.kind){if(n.readU8())return b(t,e,r.type,n);return}if("map"===r.kind){let i=new Map,o=n.readU32();for(let s=0;s<o;s++){let o=b(t,e,r.key,n),s=b(t,e,r.value,n);i.set(o,s)}return i}return v(t,r,n)}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 n=t.get(e);if(!n)throw new f("Class ".concat(e.name," is missing in schema"));if("struct"===n.kind){let n={};for(let[i,o]of t.get(e).fields)n[i]=b(t,i,o,r);return new e(n)}if("enum"===n.kind){let i=r.readU8();if(i>=n.values.length)throw new f("Enum index: ".concat(i," is out of range"));let[o,s]=n.values[i],a=b(t,o,s,r);return new e({[o]:a})}throw new f("Unexpected schema kind: ".concat(n.kind," for ").concat(e.constructor.name))}o([p],g.prototype,"readU8",null),o([p],g.prototype,"readU16",null),o([p],g.prototype,"readU32",null),o([p],g.prototype,"readU64",null),o([p],g.prototype,"readU128",null),o([p],g.prototype,"readU256",null),o([p],g.prototype,"readU512",null),o([p],g.prototype,"readString",null),o([p],g.prototype,"readFixedArray",null),o([p],g.prototype,"readArray",null),e.BinaryReader=g,e.serialize=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,n=new r;return w(t,e,n),n.toArray()},e.deserialize=function(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:g,i=new n(r),o=v(t,e,i);if(i.offset<r.length)throw new f("Unexpected ".concat(r.length-i.offset," bytes after deserialized data"));return o},e.deserializeUnchecked=function(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:g;return v(t,e,new n(r))}},46846:function(t,e,r){t.exports=r(47107)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},39774:function(t,e,r){t.exports=r(43863)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},46336:function(t,e,r){"use strict";r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(98114),r(22501),r(58910),r(30945),r(10676);var n=r(45186),i=r(17423),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(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 n=t,i=e;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|p(n,i),u=s(o),l=u.write(n,i);return l!==o&&(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=s(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)?s(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),s(t<0?0:0|d(t))}function h(t){for(var e=t.length<0?0:0|d(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function f(t,e,r){var n;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(n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),n}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,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!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(i)return n?-1:I(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){var i,o,s,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 n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=T[t[o]];return i}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}(this,e,r);case"latin1":case"binary":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}(this,e,r);case"base64":return i=this,o=e,s=r,0===o&&s===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,e,r);default:if(a)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),a=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){var o;if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(i)return -1;else r=t.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return w(t,[e],r,n,i)}throw TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;s=2,a/=2,u/=2,r/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=r;o<a;o++)if(l(t,o)===l(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*s}else -1!==c&&(o-=o-c),c=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var h=!0,f=0;f<u;f++)if(l(t,o+f)!==l(e,f)){h=!1;break}if(h)return o}return -1}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,l=t[i],c=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h<=r)switch(h){case 1:l<128&&(c=l);break;case 2:(192&(o=t[i+1]))==128&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],s=t[i+2],(192&o)==128&&(192&s)==128&&(u=(15&l)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}var f=n,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,n,i,o){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw RangeError('"value" argument is out of bounds');if(r+n>t.length)throw RangeError("Index out of range")}function S(t,e,r,n,i,o){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function E(t,e,r,n,o){return e*=1,r>>>=0,o||S(t,e,r,4,34028234663852886e22,-34028234663852886e22),i.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return e*=1,r>>>=0,o||S(t,e,r,8,17976931348623157e292,-17976931348623157e292),i.write(t,e,r,n,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)?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(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,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:+(n<r)},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,n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(B(o,Uint8Array))i+o.length>n.length?a.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(a.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},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+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,i){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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,u=Math.min(o,s),l=this.slice(n,i),c=t.slice(e,r),h=0;h<u;++h)if(l[h]!==c[h]){o=l[h],s=c[h];break}return o<s?-1:+(s<o)},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,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,s,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");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a,u=parseInt(e.substr(2*s,2),16);if((a=u)!=a)break;t[r+s]=u}return s}(this,t,e,r);case"utf8":case"utf-8":return i=e,o=r,_(I(t,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return s=e,a=r,_(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(t),this,s,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,n,i=[],o=0;o<t.length&&!((e-=2)<0);++o)n=(r=t.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(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 n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},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 n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},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),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}var o=1,s=0;for(this[e]=255&t;++s<r&&(o*=256);)this[e+s]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}var o=r-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=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.writeIntLE=function(t,e,r,n){if(t*=1,e>>>=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t*=1,e>>>=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|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,n){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r||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(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===t.length){var i,o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}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(i=e;i<r;++i)this[i]=t;else{var s=a.isBuffer(t)?t:a.from(t,n),u=s.length;if(0===u)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%u]}return this};var A=/[^+/0-9A-Za-z-_]/g;function I(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function x(t){return n.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,n){for(var i=0;i<n&&!(i+r>=e.length)&&!(i>=t.length);++i)e[i+r]=t[i];return i}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 n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},6826:function(t,e,r){"use strict";r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(98114),r(22501),r(58910),r(30945),r(10676);let n=r(45186),i=r(17423),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(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 n=t,i=e;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);let r=0|p(n,i),o=s(r),u=o.write(n,i);return u!==r&&(o=o.slice(0,u)),o}if(ArrayBuffer.isView(t)){var o=t;if(W(o,Uint8Array)){let t=new Uint8Array(o);return f(t.buffer,t.byteOffset,t.byteLength)}return h(o)}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=s(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)?s(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),s(t<0?0:0|d(t))}function h(t){let e=t.length<0?0:0|d(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function f(t,e,r){let n;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(n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),a.prototype),n}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,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return 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(i)return n?-1:L(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let i=!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 n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=z[t[n]];return i}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}(this,e,r);case"latin1":case"binary":return function(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}(this,e,r);case"base64":var o,s,a;return o=this,s=e,a=r,0===s&&a===o.length?n.fromByteArray(o):n.fromByteArray(o.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){let n=t.slice(e,r),i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}(this,e,r);default:if(i)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function m(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){var o;if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(i)return -1;else r=t.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return w(t,[e],r,n,i)}throw TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;s=2,a/=2,u/=2,r/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(l(t,o)===l(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else -1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(l(t,o+n)!==l(e,n)){r=!1;break}if(r)return o}return -1}function b(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let e=t[i],o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:(192&(r=t[i+1]))==128&&(u=(31&e)<<6|63&r)>127&&(o=u);break;case 3:r=t[i+1],n=t[i+2],(192&r)==128&&(192&n)==128&&(u=(15&e)<<12|(63&r)<<6|63&n)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}var o=n;let s=o.length;if(s<=4096)return String.fromCharCode.apply(String,o);let a="",u=0;for(;u<s;)a+=String.fromCharCode.apply(String,o.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,n,i,o){if(!a.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw RangeError('"value" argument is out of bounds');if(r+n>t.length)throw RangeError("Index out of range")}function S(t,e,r,n,i){T(e,n,i,t,r,7);let o=Number(e&BigInt(0xffffffff));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function E(t,e,r,n,i){T(e,n,i,t,r,7);let o=Number(e&BigInt(0xffffffff));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(0xffffffff));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function M(t,e,r,n,i,o){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function A(t,e,r,n,o){return e*=1,r>>>=0,o||M(t,e,r,4,34028234663852886e22,-34028234663852886e22),i.write(t,e,r,n,23,4),r+4}function I(t,e,r,n,o){return e*=1,r>>>=0,o||M(t,e,r,8,17976931348623157e292,-17976931348623157e292),i.write(t,e,r,n,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)?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(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,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:+(n<r)},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 n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))i+e.length>n.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else if(a.isBuffer(e))e.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=e.length}return n},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+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,i){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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;let o=i-n,s=r-e,u=Math.min(o,s),l=this.slice(n,i),c=t.slice(e,r);for(let t=0;t<u;++t)if(l[t]!==c[t]){o=l[t],s=c[t];break}return o<s?-1:+(s<o)},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,n){var i,o,s,a,u,l,c,h;if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let 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");n||(n="utf8");let d=!1;for(;;)switch(n){case"hex":return function(t,e,r,n){let i;r=Number(r)||0;let o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;let s=e.length;for(n>s/2&&(n=s/2),i=0;i<n;++i){var a;let n=parseInt(e.substr(2*i,2),16);if((a=n)!=a)break;t[r+i]=n}return i}(this,t,e,r);case"utf8":case"utf-8":return i=e,o=r,O(L(t,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return s=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,s,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,n,i=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)n=(r=t.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(t,this.length-c),this,c,h);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(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 n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},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 n=e+256*this[++t]+65536*this[++t]+0x1000000*this[++t],i=this[++t]+256*this[++t]+65536*this[++t]+0x1000000*r;return BigInt(n)+(BigInt(i)<<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 n=0x1000000*e+65536*this[++t]+256*this[++t]+this[++t],i=0x1000000*this[++t]+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},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),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;k(this,t,e,r,n,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;k(this,t,e,r,n,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return S(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=N(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return E(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(t,e,r,n){if(t*=1,e>>>=0,!n){let n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t*=1,e>>>=0,!n){let n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return S(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=N(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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,n){if(!a.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r||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(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);let i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},a.prototype.fill=function(t,e,r,n){let i;if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===t.length){let e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw 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(i=e;i<r;++i)this[i]=t;else{let o=a.isBuffer(t)?t:a.from(t,n),s=o.length;if(0===s)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};let x={};function _(t,e,r){x[t]=class extends r{get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return"".concat(this.name," [").concat(t,"]: ").concat(this.message)}constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name="".concat(this.name," [").concat(t,"]"),this.stack,delete this.name}}}function B(t){let e="",r=t.length,n=+("-"===t[0]);for(;r>=n+4;r-=3)e="_".concat(t.slice(r-3,r)).concat(e);return"".concat(t.slice(0,r)).concat(e)}function T(t,e,r,n,i,o){if(t>r||t<e){let n,i="bigint"==typeof e?"n":"";throw n=o>3?0===e||e===BigInt(0)?">= 0".concat(i," and < 2").concat(i," ** ").concat((o+1)*8).concat(i):">= -(2".concat(i," ** ").concat((o+1)*8-1).concat(i,") and < 2 ** ")+"".concat((o+1)*8-1).concat(i):">= ".concat(e).concat(i," and <= ").concat(r).concat(i),new x.ERR_OUT_OF_RANGE("value",n,t)}C(i,"offset"),(void 0===n[i]||void 0===n[i+o])&&R(i,n.length-(o+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",">= ".concat(+!!r," and <= ").concat(e),t)}_("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?"".concat(t," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),_("ERR_INVALID_ARG_TYPE",function(t,e){return'The "'.concat(t,'" argument must be of type number. Received type ').concat(typeof e)},TypeError),_("ERR_OUT_OF_RANGE",function(t,e,r){let n='The value of "'.concat(t,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?i=B(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),n+=" It must be ".concat(e,". Received ").concat(i)},RangeError);let P=/[^+/0-9A-Za-z-_]/g;function L(t,e){let r;e=e||1/0;let n=t.length,i=null,o=[];for(let s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function U(t){return n.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,n){let i;for(i=0;i<n&&!(i+r>=e.length)&&!(i>=t.length);++i)e[i+r]=t[i];return i}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 n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function N(t){return"undefined"==typeof BigInt?j:t}function j(){throw Error("BigInt not supported")}},62466:function(t,e,r){"use strict";r(98114),r(59781),r(19161),r(95055);let n=r(1876).v4,i=r(55325),o=function(t,e){if(!(this instanceof o))return new o(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 n()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};t.exports=o,o.prototype.request=function(t,e,r,n){let o,s=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)n=e,a=t;else{"function"==typeof r&&(n=r,r=void 0);let o="function"==typeof n;try{a=i(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(o)return n(t);throw t}if(!o)return a}try{o=JSON.stringify(a,this.options.replacer)}catch(t){return n(t)}return this.callServer(o,function(t,e){s._parseResponse(t,e,n)}),a},o.prototype._parseResponse=function(t,e,r){let n;if(t)return void r(t);if(!e)return r();try{n=JSON.parse(e,this.options.reviver)}catch(t){return r(t)}if(3===r.length)if(!Array.isArray(n))return r(null,n.error,n.result);else{let t=function(t){return void 0!==t.error};return r(null,n.filter(t),n.filter(function(e){return!t(e)}))}r(null,n)}},55325:function(t,e,r){"use strict";r(98114);let n=r(1876).v4;t.exports=function(t,e,r,i){if("string"!=typeof t)throw TypeError(t+" must be a string");let o="number"==typeof(i=i||{}).version?i.version:2;if(1!==o&&2!==o)throw TypeError(o+" must be 1 or 2");let s={method:t};if(2===o&&(s.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw TypeError(e+" must be an object, array or omitted");s.params=e}return void 0===r?s.id=("function"==typeof i.generator?i.generator:function(){return n()})(s,i):2===o&&null===r?i.notificationIdNull&&(s.id=null):s.id=r,s}},18817:function(t,e,r){r(98114),r(50036);let n=r(96675),i=r(19643),o=r(61745),s=r(72550);function a(t,e,r,o,s){let a=[].slice.call(arguments,1),u=a.length,l="function"==typeof a[u-1];if(!l&&!n())throw Error("Callback required as last argument");if(l){if(u<2)throw Error("Too few arguments provided");2===u?(s=r,r=e,e=o=void 0):3===u&&(e.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=r,r=e,e=void 0))}else{if(u<1)throw Error("Too few arguments provided");return 1===u?(r=e,e=o=void 0):2!==u||e.getContext||(o=r,r=e,e=void 0),new Promise(function(n,s){try{let s=i.create(r,o);n(t(s,e,o))}catch(t){s(t)}})}try{let n=i.create(r,o);s(null,t(n,e,o))}catch(t){s(t)}}e.create=i.create,e.toCanvas=a.bind(null,o.render),e.toDataURL=a.bind(null,o.renderToDataURL),e.toString=a.bind(null,function(t,e,r){return s.render(t,r)})},96675:function(t,e,r){r(50036),t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},33559:function(t,e,r){r(10676);let n=r(31984).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];let e=Math.floor(t/7)+2,r=n(t),i=145===r?26:2*Math.ceil((r-13)/(2*e-2)),o=[r-7];for(let t=1;t<e-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},e.getPositions=function(t){let r=[],n=e.getRowColCoords(t),i=n.length;for(let t=0;t<i;t++)for(let e=0;e<i;e++)(0!==t||0!==e)&&(0!==t||e!==i-1)&&(t!==i-1||0!==e)&&r.push([n[t],n[e]]);return r}},41523:function(t,e,r){let n=r(83670),i=["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 o(t){this.mode=n.ALPHANUMERIC,this.data=t}o.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=45*i.indexOf(this.data[e]);r+=i.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(i.indexOf(this.data[e]),6)},t.exports=o},9745:function(t,e,r){function n(){this.buffer=[],this.length=0}r(10676),n.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=n},30742:function(t,e,r){function n(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)}r(98114),r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),n.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},t.exports=n},86920:function(t,e,r){r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443);let n=r(83670);function i(t){this.mode=n.BYTE,"string"==typeof t?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}i.getBitsLength=function(t){return 8*t},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)},t.exports=i},64936:function(t,e,r){let n=r(24059),i=[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],o=[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 n.L:return i[(t-1)*4+0];case n.M:return i[(t-1)*4+1];case n.Q:return i[(t-1)*4+2];case n.H:return i[(t-1)*4+3];default:return}},e.getTotalCodewordsCount=function(t,e){switch(e){case n.L:return o[(t-1)*4+0];case n.M:return o[(t-1)*4+1];case n.Q:return o[(t-1)*4+2];case n.H:return o[(t-1)*4+3];default:return}}},24059:function(t,e,r){r(98114),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}}},10370:function(t,e,r){let n=r(31984).getSymbolSize;e.getPositions=function(t){let e=n(t);return[[0,0],[e-7,0],[0,e-7]]}},81547:function(t,e,r){let n=r(31984),i=n.getBCHDigit(1335);e.getEncodedBits=function(t,e){let r=t.bit<<3|e,o=r<<10;for(;n.getBCHDigit(o)-i>=0;)o^=1335<<n.getBCHDigit(o)-i;return(r<<10|o)^21522}},86069:function(t,e,r){r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(98114);let n=new Uint8Array(512),i=new Uint8Array(256),o=1;for(let t=0;t<255;t++)n[t]=o,i[o]=t,256&(o<<=1)&&(o^=285);for(let t=255;t<512;t++)n[t]=n[t-255];e.log=function(t){if(t<1)throw Error("log("+t+")");return i[t]},e.exp=function(t){return n[t]},e.mul=function(t,e){return 0===t||0===e?0:n[i[t]+i[e]]}},56499:function(t,e,r){r(98114);let n=r(83670),i=r(31984);function o(t){this.mode=n.KANJI,this.data=t}o.getBitsLength=function(t){return 13*t},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=i.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=o},13238:function(t,e,r){r(98114),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,n=0,i=0,o=null,s=null;for(let a=0;a<e;a++){n=i=0,o=s=null;for(let u=0;u<e;u++){let e=t.get(a,u);e===o?n++:(n>=5&&(r+=3+(n-5)),o=e,n=1),(e=t.get(u,a))===s?i++:(i>=5&&(r+=3+(i-5)),s=e,i=1)}n>=5&&(r+=3+(n-5)),i>=5&&(r+=3+(i-5))}return r},e.getPenaltyN2=function(t){let e=t.size,r=0;for(let n=0;n<e-1;n++)for(let i=0;i<e-1;i++){let e=t.get(n,i)+t.get(n,i+1)+t.get(n+1,i)+t.get(n+1,i+1);(4===e||0===e)&&r++}return 3*r},e.getPenaltyN3=function(t){let e=t.size,r=0,n=0,i=0;for(let o=0;o<e;o++){n=i=0;for(let s=0;s<e;s++)n=n<<1&2047|t.get(o,s),s>=10&&(1488===n||93===n)&&r++,i=i<<1&2047|t.get(s,o),s>=10&&(1488===i||93===i)&&r++}return 40*r},e.getPenaltyN4=function(t){let e=0,r=t.data.length;for(let n=0;n<r;n++)e+=t.data[n];return 10*Math.abs(Math.ceil(100*e/r/5)-10)},e.applyMask=function(t,r){let n=r.size;for(let i=0;i<n;i++)for(let o=0;o<n;o++)r.isReserved(o,i)||r.xor(o,i,function(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw Error("bad maskPattern:"+t)}}(t,o,i))},e.getBestMask=function(t,r){let n=Object.keys(e.Patterns).length,i=0,o=1/0;for(let s=0;s<n;s++){r(s),e.applyMask(s,t);let n=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),n<o&&(o=n,i=s)}return i}},83670:function(t,e,r){r(98114);let n=r(89700),i=r(80034);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(!n.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 i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.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}}},81515:function(t,e,r){let n=r(83670);function i(t){this.mode=n.NUMERIC,this.data=t.toString()}i.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.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 n=this.data.length-e;n>0&&(r=parseInt(this.data.substr(e),10),t.put(r,3*n+1))},t.exports=i},59687:function(t,e,r){r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443);let n=r(86069);e.mul=function(t,e){let r=new Uint8Array(t.length+e.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<e.length;o++)r[i+o]^=n.mul(t[i],e[o]);return r},e.mod=function(t,e){let r=new Uint8Array(t);for(;r.length-e.length>=0;){let t=r[0];for(let i=0;i<e.length;i++)r[i]^=n.mul(e[i],t);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let i=0;i<t;i++)r=e.mul(r,new Uint8Array([1,n.exp(i)]));return r}},19643:function(t,e,r){r(19161),r(41730),r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(98114);let n=r(31984),i=r(24059),o=r(9745),s=r(30742),a=r(33559),u=r(10370),l=r(13238),c=r(64936),h=r(43014),f=r(98861),d=r(81547),p=r(83670),g=r(4259);function m(t,e,r){let n,i,o=t.size,s=d.getEncodedBits(e,r);for(n=0;n<15;n++)i=(s>>n&1)==1,n<6?t.set(n,8,i,!0):n<8?t.set(n+1,8,i,!0):t.set(o-15+n,8,i,!0),n<8?t.set(8,o-n-1,i,!0):n<9?t.set(8,15-n-1+1,i,!0):t.set(8,15-n-1,i,!0);t.set(o-8,8,1,!0)}e.create=function(t,e){let r,d;if(void 0===t||""===t)throw Error("No input text");let y=i.M;return void 0!==e&&(y=i.from(e.errorCorrectionLevel,i.M),r=f.from(e.version),d=l.from(e.maskPattern),e.toSJISFunc&&n.setToSJISFunction(e.toSJISFunc)),function(t,e,r,i){let d;if(Array.isArray(t))d=g.fromArray(t);else if("string"==typeof t){let n=e;if(!n){let e=g.rawSplit(t);n=f.getBestVersionForData(e,r)}d=g.fromString(t,n||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 i=new o;r.forEach(function(e){i.put(e.mode.bit,4),i.put(e.getLength(),p.getCharCountIndicator(e.mode,t)),e.write(i)});let s=(n.getSymbolTotalCodewords(t)-c.getTotalCodewordsCount(t,e))*8;for(i.getLengthInBits()+4<=s&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);let a=(s-i.getLengthInBits())/8;for(let t=0;t<a;t++)i.put(t%2?17:236,8);return function(t,e,r){let i,o,s=n.getSymbolTotalCodewords(e),a=s-c.getTotalCodewordsCount(e,r),u=c.getBlocksCount(e,r),l=s%u,f=u-l,d=Math.floor(s/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(s),M=0;for(i=0;i<k;i++)for(o=0;o<u;o++)i<b[o].length&&(E[M++]=b[o][i]);for(i=0;i<m;i++)for(o=0;o<u;o++)E[M++]=v[o][i];return E}(i,t,e)}(e,r,d),b=new s(n.getSymbolSize(e));!function(t,e){let r=t.size,n=u.getPositions(e);for(let e=0;e<n.length;e++){let i=n[e][0],o=n[e][1];for(let e=-1;e<=7;e++)if(!(i+e<=-1)&&!(r<=i+e))for(let n=-1;n<=7;n++)o+n<=-1||r<=o+n||(e>=0&&e<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===e||6===e)||e>=2&&e<=4&&n>=2&&n<=4?t.set(i+e,o+n,!0,!0):t.set(i+e,o+n,!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 n=r[e][0],i=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(n+e,i+r,!0,!0):t.set(n+e,i+r,!1,!0)}}(b,e),m(b,r,0),e>=7&&function(t,e){let r,n,i,o=t.size,s=f.getEncodedBits(e);for(let e=0;e<18;e++)r=Math.floor(e/3),n=e%3+o-8-3,i=(s>>e&1)==1,t.set(r,n,i,!0),t.set(n,r,i,!0)}(b,e),!function(t,e){let r=t.size,n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!t.isReserved(i,a-r)){let n=!1;s<e.length&&(n=(e[s]>>>o&1)==1),t.set(i,a-r,n),-1==--o&&(s++,o=7)}if((i+=n)<0||r<=i){i-=n,n=-n;break}}}(b,w),isNaN(i)&&(i=l.getBestMask(b,m.bind(null,b,r))),l.applyMask(i,b),m(b,r,i),{modules:b,version:e,errorCorrectionLevel:r,maskPattern:i,segments:d}}(t,r,y,d)}},43014:function(t,e,r){r(98114),r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443);let n=r(59687);function i(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}i.prototype.initialize=function(t){this.degree=t,this.genPoly=n.generateECPolynomial(this.degree)},i.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=n.mod(e,this.genPoly),i=this.degree-r.length;if(i>0){let t=new Uint8Array(this.degree);return t.set(r,i),t}return r},t.exports=i},80034:function(t,e,r){r(22501),r(58910),r(25006),r(54067);let n="[0-9]+",i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",o="(?:(?![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(o,"g"),e.NUMERIC=RegExp(n,"g"),e.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let s=RegExp("^"+i+"$"),a=RegExp("^"+n+"$"),u=RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(t){return s.test(t)},e.testNumeric=function(t){return a.test(t)},e.testAlphanumeric=function(t){return u.test(t)}},4259:function(t,e,r){r(22501),r(10676),r(19161),r(22239),r(58814),r(8451),r(98114);let n=r(83670),i=r(81515),o=r(41523),s=r(86920),a=r(56499),u=r(80034),l=r(31984),c=r(14993);function h(t){return unescape(encodeURIComponent(t)).length}function f(t,e,r){let n,i=[];for(;null!==(n=t.exec(r));)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function d(t){let e,r,i=f(u.NUMERIC,n.NUMERIC,t),o=f(u.ALPHANUMERIC,n.ALPHANUMERIC,t);return l.isKanjiModeEnabled()?(e=f(u.BYTE,n.BYTE,t),r=f(u.KANJI,n.KANJI,t)):(e=f(u.BYTE_KANJI,n.BYTE,t),r=[]),i.concat(o,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 n.NUMERIC:return i.getBitsLength(t);case n.ALPHANUMERIC:return o.getBitsLength(t);case n.KANJI:return a.getBitsLength(t);case n.BYTE:return s.getBitsLength(t)}}function g(t,e){let r,u=n.getBestModeForData(t);if((r=n.from(e,u))!==n.BYTE&&r.bit<u.bit)throw Error('"'+t+'" cannot be encoded with mode '+n.toString(r)+".\n Suggested mode is: "+n.toString(u));switch(r===n.KANJI&&!l.isKanjiModeEnabled()&&(r=n.BYTE),r){case n.NUMERIC:return new i(t);case n.ALPHANUMERIC:return new o(t);case n.KANJI:return new a(t);case n.BYTE:return new s(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 i=function(t,e){let r={},i={start:{}},o=["start"];for(let s=0;s<t.length;s++){let a=t[s],u=[];for(let t=0;t<a.length;t++){let l=a[t],c=""+s+t;u.push(c),r[c]={node:l,lastCount:0},i[c]={};for(let t=0;t<o.length;t++){let s=o[t];r[s]&&r[s].node.mode===l.mode?(i[s][c]=p(r[s].lastCount+l.length,l.mode)-p(r[s].lastCount,l.mode),r[s].lastCount+=l.length):(r[s]&&(r[s].lastCount=l.length),i[s][c]=p(l.length,l.mode)+4+n.getCharCountIndicator(l.mode,e))}}o=u}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:r}}(function(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r];switch(i.mode){case n.NUMERIC:e.push([i,{data:i.data,mode:n.ALPHANUMERIC,length:i.length},{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.ALPHANUMERIC:e.push([i,{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.KANJI:e.push([i,{data:i.data,mode:n.BYTE,length:h(i.data)}]);break;case n.BYTE:e.push([{data:i.data,mode:n.BYTE,length:h(i.data)}])}}return e}(d(t,l.isKanjiModeEnabled())),r),o=c.find_path(i.map,"start","end"),s=[];for(let t=1;t<o.length-1;t++)s.push(i.table[o[t]].node);return e.fromArray(s.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()))}},31984:function(t,e,r){let n;r(98114);let 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.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},89700:function(t,e){e.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}},98861:function(t,e,r){r(19161),r(41730),r(98114);let n=r(31984),i=r(64936),o=r(24059),s=r(83670),a=r(89700),u=n.getBCHDigit(7973);function l(t,e){return s.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=s.BYTE);let o=(n.getSymbolTotalCodewords(t)-i.getTotalCodewordsCount(t,e))*8;if(r===s.MIXED)return o;let u=o-l(r,t);switch(r){case s.NUMERIC:return Math.floor(u/10*3);case s.ALPHANUMERIC:return Math.floor(u/11*2);case s.KANJI:return Math.floor(u/13);case s.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){let n,i=o.from(r,o.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 n=l(t.mode,e);r+=n+t.getBitsLength()}),r}(t,r)<=e.getCapacity(r,i,s.MIXED))return r;return}if(0===t.length)return 1;n=t[0]}else n=t;return function(t,r,n){for(let i=1;i<=40;i++)if(r<=e.getCapacity(i,n,t))return i}(n.mode,n.getLength(),i)},e.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw Error("Invalid QR Code version");let e=t<<12;for(;n.getBCHDigit(e)-u>=0;)e^=7973<<n.getBCHDigit(e)-u;return t<<12|e}},61745:function(t,e,r){r(98114);let n=r(56892);e.render=function(t,e,r){var i;let o=r,s=e;void 0!==o||e&&e.getContext||(o=e,e=void 0),e||(s=function(){try{return document.createElement("canvas")}catch(t){throw Error("You need to specify a canvas element")}}()),o=n.getOptions(o);let a=n.getImageWidth(t.modules.size,o),u=s.getContext("2d"),l=u.createImageData(a,a);return n.qrToImageData(l.data,t,o),i=s,u.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=a,i.width=a,i.style.height=a+"px",i.style.width=a+"px",u.putImageData(l,0,0),s},e.renderToDataURL=function(t,r,n){let i=n;void 0!==i||r&&r.getContext||(i=r,r=void 0),i||(i={});let o=e.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}},72550:function(t,e,r){let n=r(56892);function i(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function o(t,e,r){let n=t+e;return void 0!==r&&(n+=" "+r),n}e.render=function(t,e,r){let s=n.getOptions(e),a=t.modules.size,u=t.modules.data,l=a+2*s.margin,c=s.color.light.a?"<path "+i(s.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+i(s.color.dark,"stroke")+' d="'+function(t,e,r){let n="",i=0,s=!1,a=0;for(let u=0;u<t.length;u++){let l=Math.floor(u%e),c=Math.floor(u/e);l||s||(s=!0),t[u]?(a++,u>0&&l>0&&t[u-1]||(n+=s?o("M",l+r,.5+c+r):o("m",i,0),i=0,s=!1),l+1<e&&t[u+1]||(n+=o("h",a),a=0)):i++}return n}(u,a,s.margin)+'"/>',f='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+('viewBox="0 0 '+l+" ")+l+'" shape-rendering="crispEdges">'+c+h+"</svg>\n";return"function"==typeof r&&r(null,f),f}},56892:function(t,e,r){function n(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("")}}r(98114),r(22501),r(58910),r(19161),r(22239),r(10676),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,r=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:r,scale:r?4:i,margin:e,color:{dark:n(t.color.dark||"#000000ff"),light:n(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 n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){let i=r.modules.size,o=r.modules.data,s=e.getScale(i,n),a=Math.floor((i+2*n.margin)*s),u=n.margin*s,l=[n.color.light,n.color.dark];for(let e=0;e<a;e++)for(let r=0;r<a;r++){let c=(e*a+r)*4,h=n.color.light;e>=u&&r>=u&&e<a-u&&r<a-u&&(h=l[+!!o[Math.floor((e-u)/s)*i+Math.floor((r-u)/s)]]),t[c++]=h.r,t[c++]=h.g,t[c++]=h.b,t[c]=h.a}}},53112:function(){},26198:function(t,e,r){"use strict";r.d(e,{Ce:()=>a,Ok:()=>i}),r(50036),r(88711),r(10676),r(30945);var n,i,o=r(39977),s=r(47858);(n=i||(i={})).Installed="Installed",n.NotDetected="NotDetected",n.Loadable="Loadable",n.Unsupported="Unsupported";class a extends o.A{get connected(){return!!this.publicKey}async autoConnect(){await this.connect()}async prepareTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.publicKey;if(!n)throw new s.kW;return t.feePayer=t.feePayer||n,t.recentBlockhash=t.recentBlockhash||(await e.getLatestBlockhash({commitment:r.preflightCommitment,minContextSlot:r.minContextSlot})).blockhash,t}}},47858:function(t,e,r){"use strict";r.d(e,{AE:()=>i,Ez:()=>o,K3:()=>p,Kd:()=>c,PQ:()=>a,UF:()=>f,Y6:()=>s,Y8:()=>u,fk:()=>l,kW:()=>h,m7:()=>n,o7:()=>g,z4:()=>d}),r(98114),r(88711);class n extends Error{constructor(t,e){super(t),this.error=e}}class i extends n{constructor(){super(...arguments),this.name="WalletNotReadyError"}}class o extends n{constructor(){super(...arguments),this.name="WalletConfigError"}}class s extends n{constructor(){super(...arguments),this.name="WalletConnectionError"}}class a extends n{constructor(){super(...arguments),this.name="WalletDisconnectedError"}}class u extends n{constructor(){super(...arguments),this.name="WalletDisconnectionError"}}class l extends n{constructor(){super(...arguments),this.name="WalletAccountError"}}class c extends n{constructor(){super(...arguments),this.name="WalletPublicKeyError"}}class h extends n{constructor(){super(...arguments),this.name="WalletNotConnectedError"}}class f extends n{constructor(){super(...arguments),this.name="WalletSendTransactionError"}}class d extends n{constructor(){super(...arguments),this.name="WalletSignTransactionError"}}class p extends n{constructor(){super(...arguments),this.name="WalletSignMessageError"}}class g extends n{constructor(){super(...arguments),this.name="WalletSignInError"}}},43480:function(t,e,r){"use strict";r.d(e,{S:()=>s});var n=r(49836),i=r(35074),o=r(83114);let s=t=>{let{children:e,endpoint:r,config:s={commitment:"confirmed"}}=t,a=(0,i.useMemo)(()=>new n.Ng(r,s),[r,s]);return i.createElement(o.E.Provider,{value:{connection:a}},e)}},15681:function(t,e,r){"use strict";let n,i,o,s;r.d(e,{r:()=>eH}),r(19161),r(85074),r(88711),r(50036),r(98114),r(92977),r(22501),r(22239),r(32880),r(25902),r(56359),r(894),r(6373),r(63418),r(93412),r(10676);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,tn,ti,to,ts,ta,tu,tl,tc,th,tf,td,tp,tg,tm,ty,tw,tb,tv,tk,tS,tE,tM,tA,tI,tx,t_,tB=r(26198),tT=r(47858);function tC(t){return"version"in t}class tR extends tB.Ce{async sendTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!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 ".concat(t.version," isn't supported by this wallet"));try{let n=(t=await this.signTransaction(t)).serialize();return await e.sendRawTransaction(n,r)}catch(t){if(t instanceof tT.z4)throw n=!1,t;throw new tT.UF(null==t?void 0:t.message,t)}}try{let{signers:n,...i}=r;t=await this.prepareTransaction(t,e,i),(null==n?void 0:n.length)&&t.partialSign(...n);let o=(t=await this.signTransaction(t)).serialize();return await e.sendRawTransaction(o,i)}catch(t){if(t instanceof tT.z4)throw n=!1,t;throw new tT.UF(null==t?void 0:t.message,t)}}catch(t){throw n&&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 ".concat(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(49836);let tO="solana:signIn",tW="solana:signMessage",tz="solana:signAndSendTransaction",tN="solana:signTransaction";r(95055),r(41730),r(65595),r(16418),r(4214),r(43375),r(65746),r(54790),r(35469),r(18336),r(68971),r(42287),r(95801),r(93374),r(83443),r(89305),r(30945),r(18817),r(58910),r(64178),r(60962),r(60486),r(25089),r(61244),r(77895),r(25006),r(54067);let tj="".concat("(?:\\nURI: (?<uri>[^\\n]+))?").concat("(?:\\nVersion: (?<version>[^\\n]+))?").concat("(?:\\nChain ID: (?<chainId>[^\\n]+))?").concat("(?:\\nNonce: (?<nonce>[^\\n]+))?").concat("(?:\\nIssued At: (?<issuedAt>[^\\n]+))?").concat("(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?").concat("(?:\\nNot Before: (?<notBefore>[^\\n]+))?").concat("(?:\\nRequest ID: (?<requestId>[^\\n]+))?").concat("(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?");new RegExp("^".concat("(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n").concat("(?<address>[^\\n]+)(?:\\n|$)").concat("(?:\\n(?<statement>[\\S\\s]*?)(?:\\n|$))??").concat(tj,"\\n*$")),r(65999),r(58814),r(8451),r(52678);let tK="ERROR_FORBIDDEN_WALLET_BASE_URL";class tq extends Error{constructor(...t){const[e,r,n]=t;super(r),this.code=e,this.data=n,this.name="SolanaMobileWalletAdapterError"}}class tD extends Error{constructor(...t){const[e,r,n,i]=t;super(n),this.code=r,this.data=i,this.jsonRpcMessageId=e,this.name="SolanaMobileWalletAdapterProtocolError"}}function tF(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})}function tH(t,e){let r=window.btoa(String.fromCharCode.call(null,...t));return e?r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):r}function tV(t){return new Uint8Array(window.atob(t).split("").map(t=>t.charCodeAt(0)))}function tJ(t,e){return tF(this,void 0,void 0,function*(){let r=yield crypto.subtle.exportKey("raw",t),n=yield crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},e,r),i=new Uint8Array(r.byteLength+n.byteLength);return i.set(new Uint8Array(r),0),i.set(new Uint8Array(n),r.byteLength),i})}let tY="solana:cloneAuthorization";function tZ(t,e){return tF(this,void 0,void 0,function*(){let r=t.slice(0,4),i=t.slice(4,16),o=t.slice(16),s=yield crypto.subtle.decrypt(tG(r,i),e,o);return(void 0===n&&(n=new TextDecoder("utf-8")),n).decode(s)})}function tG(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function tQ(){return tF(this,void 0,void 0,function*(){return yield crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"])})}function tX(t){if(t<49152||t>65535)throw new tq("ERROR_ASSOCIATION_PORT_OUT_OF_RANGE","Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function t$(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 t3="standard:connect",t8="standard:disconnect",t6="standard:events";var t5=r(39774),t4=r(41899);function t9(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})}function t7(t,e,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function et(t,e,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r}class ee{init(){return t9(this,void 0,void 0,function*(){console.log("Injecting modal"),t7(this,u,"m",f).call(this)})}addEventListener(t,e){var r;return(null==(r=t7(this,c,"f")[t])?void 0:r.push(e))||(t7(this,c,"f")[t]=[e]),()=>this.removeEventListener(t,e)}removeEventListener(t,e){var r;t7(this,c,"f")[t]=null==(r=t7(this,c,"f")[t])?void 0:r.filter(t=>e!==t)}constructor(){var t=this;u.add(this),l.set(this,null),c.set(this,{}),h.set(this,!1),this.dom=null,this.open=()=>{console.debug("Modal open"),t7(this,u,"m",d).call(this),t7(this,l,"f")&&(t7(this,l,"f").style.display="flex")},this.close=function(){var e;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;console.debug("Modal close"),t7(t,u,"m",p).call(t),t7(t,l,"f")&&(t7(t,l,"f").style.display="none"),null==(e=t7(t,c,"f").close)||e.forEach(t=>t(r))},g.set(this,t=>{"Escape"===t.key&&this.close(t)}),this.init=this.init.bind(this),et(this,l,document.getElementById("mobile-wallet-adapter-embedded-root-ui"),"f")}}function er(t){return window.btoa(String.fromCharCode.call(null,...t))}function en(t){return new Uint8Array(window.atob(t).split("").map(t=>t.charCodeAt(0)))}l=new WeakMap,c=new WeakMap,h=new WeakMap,g=new WeakMap,u=new WeakSet,f=function(){if(document.getElementById("mobile-wallet-adapter-embedded-root-ui")){t7(this,l,"f")||et(this,l,document.getElementById("mobile-wallet-adapter-embedded-root-ui"),"f");return}et(this,l,document.createElement("div"),"f"),t7(this,l,"f").id="mobile-wallet-adapter-embedded-root-ui",t7(this,l,"f").innerHTML='\n<div class="mobile-wallet-adapter-embedded-modal-container" role="dialog" aria-modal="true" aria-labelledby="modal-title">\n <div data-modal-close style="position: absolute; width: 100%; height: 100%;"></div>\n <div class="mobile-wallet-adapter-embedded-modal-card">\n <div>\n <button data-modal-close class="mobile-wallet-adapter-embedded-modal-close">\n <svg width="14" height="14">\n <path d="M 6.7125,8.3036995 1.9082,13.108199 c -0.2113,0.2112 -0.4765,0.3168 -0.7957,0.3168 -0.3192,0 -0.5844,-0.1056 -0.7958,-0.3168 C 0.1056,12.896899 0,12.631699 0,12.312499 c 0,-0.3192 0.1056,-0.5844 0.3167,-0.7958 L 5.1212,6.7124995 0.3167,1.9082 C 0.1056,1.6969 0,1.4317 0,1.1125 0,0.7933 0.1056,0.5281 0.3167,0.3167 0.5281,0.1056 0.7933,0 1.1125,0 1.4317,0 1.6969,0.1056 1.9082,0.3167 L 6.7125,5.1212 11.5167,0.3167 C 11.7281,0.1056 11.9933,0 12.3125,0 c 0.3192,0 0.5844,0.1056 0.7957,0.3167 0.2112,0.2114 0.3168,0.4766 0.3168,0.7958 0,0.3192 -0.1056,0.5844 -0.3168,0.7957 L 8.3037001,6.7124995 13.1082,11.516699 c 0.2112,0.2114 0.3168,0.4766 0.3168,0.7958 0,0.3192 -0.1056,0.5844 -0.3168,0.7957 -0.2113,0.2112 -0.4765,0.3168 -0.7957,0.3168 -0.3192,0 -0.5844,-0.1056 -0.7958,-0.3168 z" />\n </svg>\n </button>\n </div>\n <div class="mobile-wallet-adapter-embedded-modal-content"></div>\n </div>\n</div>\n',t7(this,l,"f").style.display="none";let t=t7(this,l,"f").querySelector(".mobile-wallet-adapter-embedded-modal-content");t&&(t.innerHTML=this.contentHtml);let e=document.createElement("style");e.id="mobile-wallet-adapter-embedded-modal-styles",e.textContent='\n.mobile-wallet-adapter-embedded-modal-container {\n display: flex; /* Use flexbox to center content */\n justify-content: center; /* Center horizontally */\n align-items: center; /* Center vertically */\n position: fixed; /* Stay in place */\n z-index: 1; /* Sit on top */\n left: 0;\n top: 0;\n width: 100%; /* Full width */\n height: 100%; /* Full height */\n background-color: rgba(0,0,0,0.4); /* Black w/ opacity */\n overflow-y: auto; /* enable scrolling */\n}\n\n.mobile-wallet-adapter-embedded-modal-card {\n display: flex;\n flex-direction: column;\n margin: auto 20px;\n max-width: 780px;\n padding: 20px;\n border-radius: 24px;\n background: #ffffff;\n font-family: "Inter Tight", "PT Sans", Calibri, sans-serif;\n transform: translateY(-200%);\n animation: slide-in 0.5s forwards;\n}\n\n@keyframes slide-in {\n 100% { transform: translateY(0%); }\n}\n\n.mobile-wallet-adapter-embedded-modal-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n cursor: pointer;\n background: #e4e9e9;\n border: none;\n border-radius: 50%;\n}\n\n.mobile-wallet-adapter-embedded-modal-close:focus-visible {\n outline-color: red;\n}\n\n.mobile-wallet-adapter-embedded-modal-close svg {\n fill: #546266;\n transition: fill 200ms ease 0s;\n}\n\n.mobile-wallet-adapter-embedded-modal-close:hover svg {\n fill: #fff;\n}\n'+this.contentStyles;let r=document.createElement("div");r.innerHTML='\n<link rel="preconnect" href="https://fonts.googleapis.com">\n<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n<link href="https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">\n',this.dom=r.attachShadow({mode:"closed"}),this.dom.appendChild(e),this.dom.appendChild(t7(this,l,"f")),document.body.appendChild(r)},d=function(){!t7(this,l,"f")||t7(this,h,"f")||([...t7(this,l,"f").querySelectorAll("[data-modal-close]")].forEach(t=>null==t?void 0:t.addEventListener("click",this.close)),window.addEventListener("load",this.close),document.addEventListener("keydown",t7(this,g,"f")),et(this,h,!0,"f"))},p=function(){!t7(this,h,"f")||(window.removeEventListener("load",this.close),document.removeEventListener("keydown",t7(this,g,"f")),t7(this,l,"f")&&([...t7(this,l,"f").querySelectorAll("[data-modal-close]")].forEach(t=>null==t?void 0:t.removeEventListener("click",this.close)),et(this,h,!1,"f")))};let ei="Mobile Wallet Adapter",eo=[tz,tN,tW,tO];class es{get version(){return t7(this,w,"f")}get name(){return t7(this,b,"f")}get url(){return t7(this,v,"f")}get icon(){return t7(this,k,"f")}get chains(){return t7(this,x,"f")}get features(){return Object.assign({[t3]:{version:"1.0.0",connect:t7(this,L,"f")},[t8]:{version:"1.0.0",disconnect:t7(this,N,"f")},[t6]:{version:"1.0.0",on:t7(this,C,"f")},[tW]:{version:"1.0.0",signMessage:t7(this,J,"f")},[tO]:{version:"1.0.0",signIn:t7(this,Y,"f")}},t7(this,B,"f"))}get accounts(){var t,e;return null!=(e=null==(t=t7(this,E,"f"))?void 0:t.accounts)?e:[]}get connected(){return!!t7(this,E,"f")}get isAuthorized(){return!!t7(this,E,"f")}get currentAuthorization(){return t7(this,E,"f")}get cachedAuthorizationResult(){return t7(this,M,"f").get()}constructor(t){var e=this;m.add(this),y.set(this,{}),w.set(this,"1.0.0"),b.set(this,ei),v.set(this,"https://solanamobile.com/wallets"),k.set(this,"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03IDIuNUgxN0MxNy44Mjg0IDIuNSAxOC41IDMuMTcxNTcgMTguNSA0VjIwQzE4LjUgMjAuODI4NCAxNy44Mjg0IDIxLjUgMTcgMjEuNUg3QzYuMTcxNTcgMjEuNSA1LjUgMjAuODI4NCA1LjUgMjBWNEM1LjUgMy4xNzE1NyA2LjE3MTU3IDIuNSA3IDIuNVpNMyA0QzMgMS43OTA4NiA0Ljc5MDg2IDAgNyAwSDE3QzE5LjIwOTEgMCAyMSAxLjc5MDg2IDIxIDRWMjBDMjEgMjIuMjA5MSAxOS4yMDkxIDI0IDE3IDI0SDdDNC43OTA4NiAyNCAzIDIyLjIwOTEgMyAyMFY0Wk0xMSA0LjYxNTM4QzEwLjQ0NzcgNC42MTUzOCAxMCA1LjA2MzEgMTAgNS42MTUzOFY2LjM4NDYyQzEwIDYuOTM2OSAxMC40NDc3IDcuMzg0NjIgMTEgNy4zODQ2MkgxM0MxMy41NTIzIDcuMzg0NjIgMTQgNi45MzY5IDE0IDYuMzg0NjJWNS42MTUzOEMxNCA1LjA2MzEgMTMuNTUyMyA0LjYxNTM4IDEzIDQuNjE1MzhIMTFaIiBmaWxsPSIjRENCOEZGIi8+Cjwvc3ZnPgo="),S.set(this,void 0),E.set(this,void 0),M.set(this,void 0),A.set(this,!1),I.set(this,0),x.set(this,[]),_.set(this,void 0),B.set(this,void 0),T.set(this,void 0),C.set(this,(t,e)=>{var r;return(null==(r=t7(this,y,"f")[t])?void 0:r.push(e))||(t7(this,y,"f")[t]=[e]),()=>t7(this,m,"m",P).call(this,t,e)}),L.set(this,function(){let{silent:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t9(e,void 0,void 0,function*(){if(t7(this,A,"f")||this.connected)return{accounts:this.accounts};et(this,A,!0,"f");try{if(t){let t=yield t7(this,M,"f").get();if(!t)return{accounts:this.accounts};yield t7(this,W,"f").call(this,t.capabilities),yield t7(this,O,"f").call(this,t)}else yield t7(this,U,"f").call(this)}catch(t){throw Error(t instanceof Error&&t.message||"Unknown error")}finally{et(this,A,!1,"f")}return{accounts:this.accounts}})}),U.set(this,t=>t9(this,void 0,void 0,function*(){try{let e=yield t7(this,M,"f").get();if(e)return t7(this,O,"f").call(this,e),e;let r=yield t7(this,_,"f").select(t7(this,x,"f"));return yield t7(this,j,"f").call(this,e=>t9(this,void 0,void 0,function*(){let[n,i]=yield Promise.all([e.getCapabilities(),e.authorize({chain:r,identity:t7(this,S,"f"),sign_in_payload:t})]),o=t7(this,q,"f").call(this,i.accounts),s=Object.assign(Object.assign({},i),{accounts:o,chain:r,capabilities:n});return Promise.all([t7(this,W,"f").call(this,n),t7(this,M,"f").set(s),t7(this,O,"f").call(this,s)]),s}))}catch(t){throw Error(t instanceof Error&&t.message||"Unknown error")}})),O.set(this,t=>t9(this,void 0,void 0,function*(){var e;let r=null==t7(this,E,"f")||(null==(e=t7(this,E,"f"))?void 0:e.accounts.length)!==t.accounts.length||t7(this,E,"f").accounts.some((e,r)=>e.address!==t.accounts[r].address);et(this,E,t,"f"),r&&t7(this,m,"m",R).call(this,"change",{accounts:this.accounts})})),W.set(this,t=>t9(this,void 0,void 0,function*(){let e=t.features.includes("solana:signTransactions"),r=t.supports_sign_and_send_transactions,n=tz in this.features!==r||tN in this.features!==e;et(this,B,Object.assign(Object.assign({},(r||!r&&!e)&&{[tz]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:t7(this,H,"f")}}),e&&{[tN]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:t7(this,V,"f")}}),"f"),n&&t7(this,m,"m",R).call(this,"change",{features:this.features})})),z.set(this,(t,e,r)=>t9(this,void 0,void 0,function*(){var n,i;try{let[o,s]=yield Promise.all([null!=(i=null==(n=t7(this,E,"f"))?void 0:n.capabilities)?i:yield t.getCapabilities(),t.authorize({auth_token:e,identity:t7(this,S,"f"),chain:r})]),a=t7(this,q,"f").call(this,s.accounts),u=Object.assign(Object.assign({},s),{accounts:a,chain:r,capabilities:o});Promise.all([t7(this,M,"f").set(u),t7(this,O,"f").call(this,u)])}catch(t){throw t7(this,N,"f").call(this),Error(t instanceof Error&&t.message||"Unknown error")}})),N.set(this,()=>t9(this,void 0,void 0,function*(){var t;t7(this,M,"f").clear(),et(this,A,!1,"f"),et(this,I,(t=t7(this,I,"f"),++t),"f"),et(this,E,void 0,"f"),t7(this,m,"m",R).call(this,"change",{accounts:this.accounts})})),j.set(this,t=>t9(this,void 0,void 0,function*(){var e;let r=null==(e=t7(this,E,"f"))?void 0:e.wallet_uri_base,n=t7(this,I,"f");try{return yield function(t,e){return tF(this,void 0,void 0,function*(){let r,n;if("undefined"==typeof window||!0!==window.isSecureContext)throw new tq("ERROR_SECURE_CONTEXT_REQUIRED","The mobile wallet adapter protocol must be used in a secure context (`https`).");let i=yield function(){return tF(this,void 0,void 0,function*(){return yield crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"])})}(),o=yield function(t,e){return tF(this,void 0,void 0,function*(){let r=tX(49152+Math.floor(16384*Math.random())),n=yield function(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:["v1"];return tF(this,void 0,void 0,function*(){let i=tX(e),o=function(t){let e="",r=new Uint8Array(t),n=r.byteLength;for(let t=0;t<n;t++)e+=String.fromCharCode(r[t]);return window.btoa(e)}((yield crypto.subtle.exportKey("raw",t))),s=function(t,e){let r=null;if(e){try{r=new URL(e)}catch(t){}if((null==r?void 0:r.protocol)!=="https:")throw new tq(tK,"Base URLs supplied by wallets must be valid `https` URLs")}return r||(r=new URL("".concat("solana-wallet",":/"))),new URL(t.startsWith("/")?t:[...t$(r.pathname),...t$(t)].join("/"),r)}("v1/associate/local",r);return s.searchParams.set("association",o.replace(/[/+=]/g,t=>({"/":"_","+":"-","=":"."})[t])),s.searchParams.set("port","".concat(i)),n.forEach(t=>{s.searchParams.set("v",t)}),s})}(t,r,e);return yield function(t){return tF(this,void 0,void 0,function*(){if("https:"===t.protocol)window.location.assign(t);else try{switch(1*(-1===navigator.userAgent.indexOf("Firefox/"))){case 0:null==t0&&((t0=document.createElement("iframe")).style.display="none",document.body.appendChild(t0)),t0.contentWindow.location.href=t.toString();break;case 1:{let e=new Promise((t,e)=>{function r(){clearTimeout(i),window.removeEventListener("blur",n)}function n(){r(),t()}window.addEventListener("blur",n);let i=setTimeout(()=>{r(),e()},3e3)});window.location.assign(t),yield e}}}catch(t){throw new tq("ERROR_WALLET_NOT_FOUND","Found no installed wallet that supports the mobile wallet protocol.")}})}(n),r})}(i.publicKey,null==e?void 0:e.baseUri),s="ws://localhost:".concat(o,"/solana-wallet"),a=(n=[...t1],()=>n.length>1?n.shift():n[0]),u=1,l=0,c={__type:"disconnected"};return new Promise((e,n)=>{let o,h,f,d={},p=()=>tF(this,void 0,void 0,function*(){if("connecting"!==c.__type)return void console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(c.__type,"`."));o.removeEventListener("open",p);let{associationKeypair:t}=c,e=yield tQ();o.send((yield tJ(e.publicKey,t.privateKey))),c={__type:"hello_req_sent",associationPublicKey:t.publicKey,ecdhPrivateKey:e.privateKey}}),g=t=>{t.wasClean?c={__type:"disconnected"}:n(new tq("ERROR_SESSION_CLOSED","The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),h()},m=t=>tF(this,void 0,void 0,function*(){h(),Date.now()-r>=3e4?n(new tq("ERROR_SESSION_TIMEOUT","Failed to connect to the wallet websocket at ".concat(s,"."))):(yield new Promise(t=>{let e=a();f=window.setTimeout(t,e)}),w())}),y=r=>tF(this,void 0,void 0,function*(){let s=yield r.data.arrayBuffer();switch(c.__type){case"connecting":if(0!==s.byteLength)throw Error("Encountered unexpected message while connecting");let a=yield tQ();o.send((yield tJ(a.publicKey,i.privateKey))),c={__type:"hello_req_sent",associationPublicKey:i.publicKey,ecdhPrivateKey:a.privateKey};break;case"connected":try{let t=s.slice(0,4),e=t2(t);if(e!==l+1)throw Error("Encrypted message has invalid sequence number");l=e;let r=yield function(t,e){return tF(this,void 0,void 0,function*(){let r=JSON.parse((yield tZ(t,e)));if(Object.hasOwnProperty.call(r,"error"))throw new tD(r.id,r.error.code,r.error.message);return r})}(s,c.sharedSecret),n=d[r.id];delete d[r.id],n.resolve(r.result)}catch(t){if(t instanceof tD){let e=d[t.jsonRpcMessageId];delete d[t.jsonRpcMessageId],e.reject(t)}else throw t}break;case"hello_req_sent":{var f,p;if(0===s.byteLength){let t=yield tQ();o.send((yield tJ(t.publicKey,i.privateKey))),c={__type:"hello_req_sent",associationPublicKey:i.publicKey,ecdhPrivateKey:t.privateKey};break}let r=yield function(t,e,r){return tF(this,void 0,void 0,function*(){let[n,i]=yield Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t.slice(0,65),{name:"ECDH",namedCurve:"P-256"},!1,[])]),o=yield crypto.subtle.deriveBits({name:"ECDH",public:i},r,256),s=yield crypto.subtle.importKey("raw",o,"HKDF",!1,["deriveKey"]);return yield crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(n),info:new Uint8Array},s,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"])})}(s,c.associationPublicKey,c.ecdhPrivateKey),a=s.slice(65),g=0!==a.byteLength?yield tF(this,void 0,void 0,function*(){let t=t2(a.slice(0,4));if(t!==l+1)throw Error("Encrypted message has invalid sequence number");return l=t,function(t,e){return tF(this,void 0,void 0,function*(){let r=JSON.parse((yield tZ(t,e))),n="legacy";if(Object.hasOwnProperty.call(r,"v"))switch(r.v){case 1:case"1":case"v1":n="v1";break;case"legacy":n="legacy";break;default:throw new tq("ERROR_INVALID_PROTOCOL_VERSION","Unknown/unsupported protocol version: ".concat(r.v))}return{protocol_version:n}})}(a,r)}):{protocol_version:"legacy"};c={__type:"connected",sharedSecret:r,sessionProperties:g};let m=(f=g.protocol_version,p=(t,e)=>tF(this,void 0,void 0,function*(){let n=u++;return o.send((yield function(t,e){return tF(this,void 0,void 0,function*(){let r=JSON.stringify(t);return function(t,e,r){return tF(this,void 0,void 0,function*(){let n=function(t){if(t>=0x100000000)throw Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");let e=new ArrayBuffer(4);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}(e),i=new Uint8Array(12);crypto.getRandomValues(i);let o=yield crypto.subtle.encrypt(tG(n,i),r,new TextEncoder().encode(t)),s=new Uint8Array(n.byteLength+i.byteLength+o.byteLength);return s.set(new Uint8Array(n),0),s.set(new Uint8Array(i),n.byteLength),s.set(new Uint8Array(o),n.byteLength+i.byteLength),s})}(r,t.id,e)})}({id:n,jsonrpc:"2.0",method:t,params:null!=e?e:{}},r))),new Promise((e,r)=>{d[n]={resolve(n){switch(t){case"authorize":case"reauthorize":{let{wallet_uri_base:t}=n;if(null!=t)try{let e;try{e=new URL(t)}catch(t){throw new tq(tK,"Invalid base URL supplied by wallet")}if("https:"!==e.protocol)throw new tq(tK,"Base URLs supplied by wallets must be valid `https` URLs")}catch(t){r(t);return}}}e(n)},reject:r}})}),new Proxy({},{get:(t,e)=>"then"===e?null:(null==t[e]&&(t[e]=function(t){return tF(this,void 0,void 0,function*(){let{method:r,params:n}=function(t,e,r){let n=e,i=t.toString().replace(/[A-Z]/g,t=>"_".concat(t.toLowerCase())).toLowerCase();switch(t){case"authorize":{let{chain:t}=n;if("legacy"===r){switch(t){case"solana:testnet":t="testnet";break;case"solana:devnet":t="devnet";break;case"solana:mainnet":t="mainnet-beta";break;default:t=n.cluster}n.cluster=t}else{switch(t){case"testnet":case"devnet":t="solana:".concat(t);break;case"mainnet-beta":t="solana:mainnet"}n.chain=t}}case"reauthorize":{let{auth_token:t,identity:e}=n;t&&("legacy"===r?(i="reauthorize",n={auth_token:t,identity:e}):i="authorize")}}return{method:i,params:n}}(e,t,f),i=yield p(r,n);return"authorize"===r&&n.sign_in_payload&&!i.sign_in_result&&(i.sign_in_result=yield function(t,e,r){var n;return tF(this,void 0,void 0,function*(){var i,o,s,a;let u=null!=(n=t.domain)?n:window.location.host,l=e.accounts[0].address,c=(a=function(t){let e="".concat(t.domain," wants you to sign in with your Solana account:\n");e+="".concat(t.address),t.statement&&(e+="\n\n".concat(t.statement));let r=[];if(t.uri&&r.push("URI: ".concat(t.uri)),t.version&&r.push("Version: ".concat(t.version)),t.chainId&&r.push("Chain ID: ".concat(t.chainId)),t.nonce&&r.push("Nonce: ".concat(t.nonce)),t.issuedAt&&r.push("Issued At: ".concat(t.issuedAt)),t.expirationTime&&r.push("Expiration Time: ".concat(t.expirationTime)),t.notBefore&&r.push("Not Before: ".concat(t.notBefore)),t.requestId&&r.push("Request ID: ".concat(t.requestId)),t.resources)for(let e of(r.push("Resources:"),t.resources))r.push("- ".concat(e));return r.length&&(e+="\n\n".concat(r.join("\n"))),e}(Object.assign(Object.assign({},t),{domain:u,address:(i=tV(l),(o="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Object.freeze({...s={read(t,e){let r=0===e?t:t.slice(e);if(0===r.length)return["",0];let n=r.findIndex(t=>0!==t);n=-1===n?r.length:n;let i=o[0].repeat(n);return n===r.length?[i,t.length]:[i+function(t,e){let r=BigInt(e.length),n=[];for(;t>0n;)n.unshift(e[Number(t%r)]),t/=r;return n.join("")}(r.slice(n).reduce((t,e)=>256n*t+BigInt(e),0n),o),t.length]}},decode:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return s.read(t,e)[0]}})).decode(i))})),window.btoa(a)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),h=tV((yield r("sign_messages",{addresses:[l],payloads:[c]})).signed_payloads[0]),f=tH(h.slice(0,h.length-64)),d=tH(h.slice(h.length-64));return{address:l,signed_message:0==f.length?c:f,signature:d}})}(n.sign_in_payload,i,p)),function(t,e,r){if("getCapabilities"===t)switch(r){case"legacy":{let t=["solana:signTransactions"];return!0===e.supports_clone_authorization&&t.push(tY),Object.assign(Object.assign({},e),{features:t})}case"v1":return Object.assign(Object.assign({},e),{supports_sign_and_send_transactions:!0,supports_clone_authorization:e.features.includes(tY)})}return e}(e,i,f)})}),t[e]),defineProperty:()=>!1,deleteProperty:()=>!1}));try{e((yield t(m)))}catch(t){n(t)}finally{h(),o.close()}}}}),w=()=>{h&&h(),c={__type:"connecting",associationKeypair:i},void 0===r&&(r=Date.now()),(o=new WebSocket(s,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",p),o.addEventListener("close",g),o.addEventListener("error",m),o.addEventListener("message",y),h=()=>{window.clearTimeout(f),o.removeEventListener("open",p),o.removeEventListener("close",g),o.removeEventListener("error",m),o.removeEventListener("message",y)}};w()})})}(t,r?{baseUri:r}:void 0)}catch(t){throw t7(this,I,"f")!==n&&(yield new Promise(()=>{})),t instanceof Error&&"SolanaMobileWalletAdapterError"===t.name&&"ERROR_WALLET_NOT_FOUND"===t.code&&(yield t7(this,T,"f").call(this,this)),t}})),K.set(this,()=>{if(!t7(this,E,"f"))throw Error("Wallet not connected");return{authToken:t7(this,E,"f").auth_token,chain:t7(this,E,"f").chain}}),q.set(this,t=>t.map(t=>{var e,r;let n=en(t.address);return{address:t5.encode(n),publicKey:n,label:t.label,icon:t.icon,chains:null!=(e=t.chains)?e:t7(this,x,"f"),features:null!=(r=t.features)?r:eo}})),D.set(this,t=>t9(this,void 0,void 0,function*(){let{authToken:e,chain:r}=t7(this,K,"f").call(this);try{let n=t.map(t=>er(t));return yield t7(this,j,"f").call(this,t=>t9(this,void 0,void 0,function*(){return yield t7(this,z,"f").call(this,t,e,r),(yield t.signTransactions({payloads:n})).signed_payloads.map(en)}))}catch(t){throw Error(t instanceof Error&&t.message||"Unknown error")}})),F.set(this,(t,e)=>t9(this,void 0,void 0,function*(){let{authToken:r,chain:n}=t7(this,K,"f").call(this);try{return yield t7(this,j,"f").call(this,i=>t9(this,void 0,void 0,function*(){let[o,s]=yield Promise.all([i.getCapabilities(),t7(this,z,"f").call(this,i,r,n)]);if(o.supports_sign_and_send_transactions){let r=er(t);return(yield i.signAndSendTransactions(Object.assign(Object.assign({},e),{payloads:[r]}))).signatures.map(en)[0]}throw Error("connected wallet does not support signAndSendTransaction")}))}catch(t){throw Error(t instanceof Error&&t.message||"Unknown error")}})),H.set(this,function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return t9(e,void 0,void 0,function*(){let t=[];for(let e of r){let r=yield t7(this,F,"f").call(this,e.transaction,e.options);t.push({signature:r})}return t})}),V.set(this,function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return t9(e,void 0,void 0,function*(){return(yield t7(this,D,"f").call(this,r.map(t=>{let{transaction:e}=t;return e}))).map(t=>({signedTransaction:t}))})}),J.set(this,function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return t9(e,void 0,void 0,function*(){let{authToken:t,chain:e}=t7(this,K,"f").call(this),n=r.map(t=>{let{account:e}=t;return er(e.publicKey)}),i=r.map(t=>{let{message:e}=t;return er(e)});try{return yield t7(this,j,"f").call(this,r=>t9(this,void 0,void 0,function*(){return yield t7(this,z,"f").call(this,r,t,e),(yield r.signMessages({addresses:n,payloads:i})).signed_payloads.map(en).map(t=>({signedMessage:t,signature:t.slice(-64)}))}))}catch(t){throw Error(t instanceof Error&&t.message||"Unknown error")}})}),Y.set(this,function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return t9(e,void 0,void 0,function*(){let t=[];if(!(r.length>1))return[(yield t7(this,Z,"f").call(this,r[0]))];for(let e of r)t.push((yield t7(this,Z,"f").call(this,e)));return t})}),Z.set(this,t=>t9(this,void 0,void 0,function*(){var e,r,n;et(this,A,!0,"f");try{let i=yield t7(this,U,"f").call(this,Object.assign(Object.assign({},t),{domain:null!=(e=null==t?void 0:t.domain)?e:window.location.host}));if(!i.sign_in_result)throw Error("Sign in failed, no sign in result returned by wallet");let o=i.sign_in_result.address,s=i.accounts.find(t=>t.address==o);return{account:Object.assign(Object.assign({},null!=s?s:{address:t5.encode(en(o))}),{publicKey:en(o),chains:null!=(r=null==s?void 0:s.chains)?r:t7(this,x,"f"),features:null!=(n=null==s?void 0:s.features)?n:i.capabilities.features}),signedMessage:en(i.sign_in_result.signed_message),signature:en(i.sign_in_result.signature)}}catch(t){throw Error(t instanceof Error&&t.message||"Unknown error")}finally{et(this,A,!1,"f")}})),et(this,M,t.authorizationCache,"f"),et(this,S,t.appIdentity,"f"),et(this,x,t.chains,"f"),et(this,_,t.chainSelector,"f"),et(this,T,t.onWalletNotFound,"f"),et(this,B,{[tz]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:t7(this,H,"f")},[tN]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:t7(this,V,"f")}},"f")}}y=new WeakMap,w=new WeakMap,b=new WeakMap,v=new WeakMap,k=new WeakMap,S=new WeakMap,E=new WeakMap,M=new WeakMap,A=new WeakMap,I=new WeakMap,x=new WeakMap,_=new WeakMap,B=new WeakMap,T=new WeakMap,C=new WeakMap,L=new WeakMap,U=new WeakMap,O=new WeakMap,W=new WeakMap,z=new WeakMap,N=new WeakMap,j=new WeakMap,K=new WeakMap,q=new WeakMap,D=new WeakMap,F=new WeakMap,H=new WeakMap,V=new WeakMap,J=new WeakMap,Y=new WeakMap,Z=new WeakMap,m=new WeakSet,R=function(t){for(var e,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];null==(e=t7(this,y,"f")[t])||e.forEach(t=>t.apply(null,n))},P=function(t,e){var r;t7(this,y,"f")[t]=null==(r=t7(this,y,"f")[t])?void 0:r.filter(t=>e!==t)},new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakSet;Event,new WeakMap;class ea extends ee{initWithError(t){super.init(),this.populateError(t)}populateError(t){var e,r;let n=null==(e=this.dom)?void 0:e.getElementById("mobile-wallet-adapter-error-message"),i=null==(r=this.dom)?void 0:r.getElementById("mobile-wallet-adapter-error-action");if(n){if("SolanaMobileWalletAdapterError"===t.name)switch(t.code){case"ERROR_WALLET_NOT_FOUND":n.innerHTML="To use mobile wallet adapter, you must have a compatible mobile wallet application installed on your device.",i&&i.addEventListener("click",()=>{window.location.href="https://solanamobile.com/wallets"});return;case"ERROR_BROWSER_NOT_SUPPORTED":n.innerHTML="This browser appears to be incompatible with mobile wallet adapter. Open this page in a compatible mobile browser app and try again.",i&&(i.style.display="none");return}n.innerHTML="An unexpected error occurred: ".concat(t.message)}else console.log("Failed to locate error dialog element")}constructor(){super(...arguments),this.contentStyles=el,this.contentHtml=eu}}let eu='\n<svg class="mobile-wallet-adapter-embedded-modal-error-icon" xmlns="http://www.w3.org/2000/svg" height="50px" viewBox="0 -960 960 960" width="50px" fill="#000000"><path d="M 280,-80 Q 197,-80 138.5,-138.5 80,-197 80,-280 80,-363 138.5,-421.5 197,-480 280,-480 q 83,0 141.5,58.5 58.5,58.5 58.5,141.5 0,83 -58.5,141.5 Q 363,-80 280,-80 Z M 824,-120 568,-376 Q 556,-389 542.5,-402.5 529,-416 516,-428 q 38,-24 61,-64 23,-40 23,-88 0,-75 -52.5,-127.5 Q 495,-760 420,-760 345,-760 292.5,-707.5 240,-655 240,-580 q 0,6 0.5,11.5 0.5,5.5 1.5,11.5 -18,2 -39.5,8 -21.5,6 -38.5,14 -2,-11 -3,-22 -1,-11 -1,-23 0,-109 75.5,-184.5 Q 311,-840 420,-840 q 109,0 184.5,75.5 75.5,75.5 75.5,184.5 0,43 -13.5,81.5 Q 653,-460 629,-428 l 251,252 z m -615,-61 71,-71 70,71 29,-28 -71,-71 71,-71 -28,-28 -71,71 -71,-71 -28,28 71,71 -71,71 z"/></svg>\n<div class="mobile-wallet-adapter-embedded-modal-title">We can\'t find a wallet.</div>\n<div id="mobile-wallet-adapter-error-message" class="mobile-wallet-adapter-embedded-modal-subtitle"></div>\n<div>\n <button data-error-action id="mobile-wallet-adapter-error-action" class="mobile-wallet-adapter-embedded-modal-error-action">\n Find a wallet\n </button>\n</div>\n',el="\n.mobile-wallet-adapter-embedded-modal-content {\n text-align: center;\n}\n\n.mobile-wallet-adapter-embedded-modal-error-icon {\n margin-top: 24px;\n}\n\n.mobile-wallet-adapter-embedded-modal-title {\n margin: 18px 100px auto 100px;\n color: #000000;\n font-size: 2.75em;\n font-weight: 600;\n}\n\n.mobile-wallet-adapter-embedded-modal-subtitle {\n margin: 30px 60px 40px 60px;\n color: #000000;\n font-size: 1.25em;\n font-weight: 400;\n}\n\n.mobile-wallet-adapter-embedded-modal-error-action {\n display: block;\n width: 100%;\n height: 56px;\n /*margin-top: 40px;*/\n font-size: 1.25em;\n /*line-height: 24px;*/\n /*letter-spacing: -1%;*/\n background: #000000;\n color: #FFFFFF;\n border-radius: 18px;\n}\n\n/* Smaller screens */\n@media all and (max-width: 600px) {\n .mobile-wallet-adapter-embedded-modal-title {\n font-size: 1.5em;\n margin-right: 12px;\n margin-left: 12px;\n }\n .mobile-wallet-adapter-embedded-modal-subtitle {\n margin-right: 12px;\n margin-left: 12px;\n }\n}\n",ec="SolanaMobileWalletAdapterDefaultAuthorizationCache";function eh(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})}function ef(t,e,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function ed(t,e,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r}let ep="standard:connect";function eg(t){return window.btoa(String.fromCharCode.call(null,...t))}function em(t){switch(t){case"mainnet-beta":return"solana:mainnet";case"testnet":return"solana:testnet";case"devnet":return"solana:devnet";default:return t}}class ey extends tL{get publicKey(){var t;if(!ef(this,tr,"f")&&ef(this,te,"f"))try{ed(this,tr,new tU.J3(ef(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=ef(this,tr,"f"))?t:null}get connected(){return ef(this,Q,"f").connected}get connecting(){return ef(this,X,"f")}get readyState(){return ef(this,$,"f")}autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(){return eh(this,void 0,void 0,function*(){return yield this.autoConnect()})}autoConnect(){return eh(this,void 0,void 0,function*(){ef(this,G,"m",ti).call(this,!0)})}connect(){return eh(this,void 0,void 0,function*(){ef(this,G,"m",ti).call(this)})}performAuthorization(t){return eh(this,void 0,void 0,function*(){try{let e=yield ef(this,Q,"f").cachedAuthorizationResult;if(e)return yield ef(this,Q,"f").features[ep].connect({silent:!0}),e;return t?yield ef(this,Q,"f").features[tO].signIn(t):yield ef(this,Q,"f").features[ep].connect(),yield yield ef(this,Q,"f").cachedAuthorizationResult}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}})}disconnect(){return eh(this,void 0,void 0,function*(){return yield ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){ed(this,X,!1,"f"),ed(this,tr,void 0,"f"),ed(this,te,void 0,"f"),yield ef(this,Q,"f").features["standard:disconnect"].disconnect(),this.emit("disconnect")}))})}signIn(t){return eh(this,void 0,void 0,function*(){return ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){var e;if(ef(this,$,"f")!==tB.Ok.Installed&&ef(this,$,"f")!==tB.Ok.Loadable)throw new tT.AE;ed(this,X,!0,"f");try{let r=yield ef(this,Q,"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{ed(this,X,!1,"f")}}))})}signMessage(t){return eh(this,void 0,void 0,function*(){return yield ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){let e=ef(this,G,"m",ts).call(this);try{return(yield ef(this,Q,"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 eh(this,void 0,void 0,function*(){return yield ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){let n=ef(this,G,"m",ts).call(this);try{if(tz in ef(this,Q,"f").features){let e=em(ef(this,Q,"f").currentAuthorization.chain),[i]=(yield ef(this,Q,"f").features[tz].signAndSendTransaction({account:n,transaction:t.serialize(),chain:e,options:r?{skipPreflight:r.skipPreflight,maxRetries:r.maxRetries}:void 0})).map(t=>eg(t.signature));return i}{let[n]=yield ef(this,G,"m",ta).call(this,[t]);if("version"in n)return yield e.sendTransaction(n);{let t=n.serialize();return yield e.sendRawTransaction(t,Object.assign(Object.assign({},r),{preflightCommitment:function(){let t,n;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":n=r.preflightCommitment;break;case void 0:n=t;break;default:n="finalized"}let i="finalized"===n?2:+("confirmed"===n),o="finalized"===t?2:+("confirmed"===t);return i<o?n:t}()}))}}}catch(t){throw new tT.UF(null==t?void 0:t.message,t)}}))})}signTransaction(t){return eh(this,void 0,void 0,function*(){return yield ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){let[e]=yield ef(this,G,"m",ta).call(this,[t]);return e}))})}signAllTransactions(t){return eh(this,void 0,void 0,function*(){return yield ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){return yield ef(this,G,"m",ta).call(this,t)}))})}constructor(t,e){super(),G.add(this),this.supportedTransactionVersions=new Set(["legacy",0]),Q.set(this,void 0),X.set(this,!1),$.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),tn.set(this,t=>eh(this,void 0,void 0,function*(){if(t.accounts&&t.accounts.length>0){ef(this,G,"m",to).call(this);let e=yield ef(this,tt,"f").call(this,t.accounts);e!==ef(this,te,"f")&&(ed(this,te,e,"f"),ed(this,tr,void 0,"f"),this.emit("connect",this.publicKey))}})),ed(this,tt,t=>eh(this,void 0,void 0,function*(){var r;let n=yield e.addressSelector.select(t.map(t=>{let{publicKey:e}=t;return eg(e)}));return null!=(r=t.find(t=>{let{publicKey:e}=t;return eg(e)===n}))?r:t[0]}),"f"),ed(this,Q,t,"f"),ef(this,Q,"f").features["standard:events"].on("change",ef(this,tn,"f")),this.name=ef(this,Q,"f").name,this.icon=ef(this,Q,"f").icon,this.url=ef(this,Q,"f").url}}Q=new WeakMap,X=new WeakMap,$=new WeakMap,tt=new WeakMap,te=new WeakMap,tr=new WeakMap,tn=new WeakMap,G=new WeakSet,ti=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return eh(this,void 0,void 0,function*(){if(!this.connecting&&!this.connected)return yield ef(this,G,"m",tu).call(this,()=>eh(this,void 0,void 0,function*(){if(ef(this,$,"f")!==tB.Ok.Installed&&ef(this,$,"f")!==tB.Ok.Loadable)throw new tT.AE;ed(this,X,!0,"f");try{yield ef(this,Q,"f").features[ep].connect({silent:t})}catch(t){throw new tT.Y6(t instanceof Error&&t.message||"Unknown error",t)}finally{ed(this,X,!1,"f")}}))})},to=function(){ef(this,$,"f")!==tB.Ok.Installed&&this.emit("readyStateChange",ed(this,$,tB.Ok.Installed,"f"))},ts=function(){if(!ef(this,Q,"f").isAuthorized||!ef(this,te,"f"))throw new tT.kW;return ef(this,te,"f")},ta=function(t){return eh(this,void 0,void 0,function*(){let e=ef(this,G,"m",ts).call(this);try{if(tN in ef(this,Q,"f").features)return ef(this,Q,"f").features[tN].signTransaction(...t.map(t=>({account:e,transaction:t.serialize()}))).then(t=>t.map(t=>{let e=t.signedTransaction,r=e[0],n=tU.B2.deserializeMessageVersion(e.slice(64*r+1,e.length));return"legacy"===n?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 eh(this,void 0,void 0,function*(){try{return yield t()}catch(t){throw this.emit("error",t),t}})};class ew extends ey{constructor(t){var e;const r=em(null!=(e=t.chain)?e:t.cluster);super(new es({appIdentity:t.appIdentity,authorizationCache:{set:t.authorizationResultCache.set,get:()=>eh(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:()=>eh(this,void 0,void 0,function*(){t.onWalletNotFound(this)})}),{addressSelector:t.addressSelector,chain:r})}}class eb extends ew{}function ev(t){return eh(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 ea;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 ek=function(t){return t3 in t.features&&t6 in t.features&&(tz in t.features||tN in t.features)};var eS=r(26137);function eE(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 eM=(0,r(36705).A)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var eA=function(t,e,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)},eI=function(t,e,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r};class ex extends tB.Ce{get name(){return eA(this,tm,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return eA(this,tm,"f").icon}get readyState(){return eA(this,ty,"f")}get publicKey(){return eA(this,th,"f")}get connecting(){return eA(this,tf,"f")}get supportedTransactionVersions(){return eA(this,tg,"f")}get wallet(){return eA(this,tm,"f")}get standard(){return!0}destroy(){eI(this,tc,null,"f"),eI(this,th,null,"f"),eI(this,tf,!1,"f"),eI(this,td,!1,"f");let t=eA(this,tp,"f");t&&(eI(this,tp,null,"f"),t())}async autoConnect(){return eA(this,tl,"m",tw).call(this,{silent:!0})}async connect(){return eA(this,tl,"m",tw).call(this)}async disconnect(){if(t8 in eA(this,tm,"f").features)try{eI(this,td,!0,"f"),await eA(this,tm,"f").features[t8].disconnect()}catch(t){this.emit("error",new tT.Y8(null==t?void 0:t.message,t))}finally{eI(this,td,!1,"f")}eA(this,tl,"m",tv).call(this)}async sendTransaction(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{let n,i=eA(this,tc,"f");if(!i)throw new tT.kW;if(tz in eA(this,tm,"f").features)if(i.features.includes(tz))n=tz;else if(tN in eA(this,tm,"f").features&&i.features.includes(tN))n=tN;else throw new tT.fk;else if(tN in eA(this,tm,"f").features){if(!i.features.includes(tN))throw new tT.fk;n=tN}else throw new tT.Ez;let o=(0,eS.GZ)(e.rpcEndpoint);if(!i.chains.includes(o))throw new tT.UF;try{let s,{signers:a,...u}=r;if(tC(t)?((null==a?void 0:a.length)&&t.sign(a),s=t.serialize()):(t=await this.prepareTransaction(t,e,u),(null==a?void 0:a.length)&&t.partialSign(...a),s=new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))),n===tz){let[t]=await eA(this,tm,"f").features[tz].signAndSendTransaction({account:i,chain:o,transaction:s,options:{preflightCommitment:eE(u.preflightCommitment||e.commitment),skipPreflight:u.skipPreflight,maxRetries:u.maxRetries,minContextSlot:u.minContextSlot}});return eM.encode(t.signature)}{let[t]=await eA(this,tm,"f").features[tN].signTransaction({account:i,chain:o,transaction:s,options:{preflightCommitment:eE(u.preflightCommitment||e.commitment),minContextSlot:u.minContextSlot}});return await e.sendRawTransaction(t.signedTransaction,{...u,preflightCommitment:eE(u.preflightCommitment||e.commitment)})}}catch(t){if(t instanceof tT.m7)throw t;throw new tT.UF(null==t?void 0:t.message,t)}}catch(t){throw this.emit("error",t),t}}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=eA(this,tm,"f").accounts[0];eA(this,tc,"f")&&!eA(this,td,"f")&&t!==eA(this,tc,"f")&&(t?eA(this,tl,"m",tb).call(this,t):(this.emit("error",new tT.PQ),eA(this,tl,"m",tv).call(this)))}"features"in t&&eA(this,tl,"m",tk).call(this)}),eI(this,tm,t,"f"),eI(this,tc,null,"f"),eI(this,th,null,"f"),eI(this,tf,!1,"f"),eI(this,td,!1,"f"),eI(this,tp,eA(this,tm,"f").features[t6].on("change",eA(this,tS,"f")),"f"),eA(this,tl,"m",tk).call(this)}}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(eA(this,ty,"f")!==tB.Ok.Installed)throw new tT.AE;if(eI(this,tf,!0,"f"),!eA(this,tm,"f").accounts.length)try{await eA(this,tm,"f").features[t3].connect(t)}catch(t){throw new tT.Y6(null==t?void 0:t.message,t)}let e=eA(this,tm,"f").accounts[0];if(!e)throw new tT.fk;eA(this,tl,"m",tb).call(this,e)}catch(t){throw this.emit("error",t),t}finally{eI(this,tf,!1,"f")}},tb=function(t){let e;try{e=new tU.J3(t.address)}catch(t){throw new tT.Kd(null==t?void 0:t.message,t)}eI(this,tc,t,"f"),eI(this,th,e,"f"),eA(this,tl,"m",tk).call(this),this.emit("connect",e)},tv=function(){eI(this,tc,null,"f"),eI(this,th,null,"f"),eA(this,tl,"m",tk).call(this),this.emit("disconnect")},tk=function(){var t,e;let r=tz in eA(this,tm,"f").features?eA(this,tm,"f").features[tz].supportedTransactionVersions:eA(this,tm,"f").features[tN].supportedTransactionVersions;eI(this,tg,!function(t,e){if(t===e)return!0;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}(r,["legacy"])?new Set(r):null,"f"),tN in eA(this,tm,"f").features&&(null==(t=eA(this,tc,"f"))?void 0:t.features.includes(tN))?(this.signTransaction=eA(this,tl,"m",tE),this.signAllTransactions=eA(this,tl,"m",tM)):(delete this.signTransaction,delete this.signAllTransactions),tW in eA(this,tm,"f").features&&(null==(e=eA(this,tc,"f"))?void 0:e.features.includes(tW))?this.signMessage=eA(this,tl,"m",tA):delete this.signMessage,tO in eA(this,tm,"f").features?this.signIn=eA(this,tl,"m",tI):delete this.signIn},tE=async function(t){try{let e=eA(this,tc,"f");if(!e)throw new tT.kW;if(!(tN in eA(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tN))throw new tT.fk;try{let r=(await eA(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(null==t?void 0:t.message,t)}}catch(t){throw this.emit("error",t),t}},tM=async function(t){try{let e=eA(this,tc,"f");if(!e)throw new tT.kW;if(!(tN in eA(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tN))throw new tT.fk;try{let r=await eA(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 n=r[e].signedTransaction;return tC(t)?tU.Kt.deserialize(n):tU.ZX.from(n)})}catch(t){throw new tT.z4(null==t?void 0:t.message,t)}}catch(t){throw this.emit("error",t),t}},tA=async function(t){try{let e=eA(this,tc,"f");if(!e)throw new tT.kW;if(!(tW in eA(this,tm,"f").features))throw new tT.Ez;if(!e.features.includes(tW))throw new tT.fk;try{return(await eA(this,tm,"f").features[tW].signMessage({account:e,message:t}))[0].signature}catch(t){throw new tT.K3(null==t?void 0:t.message,t)}}catch(t){throw this.emit("error",t),t}},tI=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let e;if(!(tO in eA(this,tm,"f").features))throw new tT.Ez;try{[e]=await eA(this,tm,"f").features[tO].signIn(t)}catch(t){throw new tT.o7(null==t?void 0:t.message,t)}if(!e)throw new tT.o7;return eA(this,tl,"m",tb).call(this,e.account),e}catch(t){throw this.emit("error",t),t}};var e_=function(t,e,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)},eB=function(t,e,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r};let eT=new Set,eC={};function eR(){for(var t,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return(r=r.filter(t=>!eT.has(t))).length?(r.forEach(t=>{i=void 0,eT.add(t)}),null==(t=eC.register)||t.forEach(t=>eU(()=>t(...r))),function(){var t;r.forEach(t=>{i=void 0,eT.delete(t)}),null==(t=eC.unregister)||t.forEach(t=>eU(()=>t(...r)))}):()=>{}}function eP(){return i||(i=[...eT]),i}function eL(t,e){var r;return(null==(r=eC[t])?void 0:r.push(e))||(eC[t]=[e]),function(){var r;eC[t]=null==(r=eC[t])?void 0:r.filter(t=>e!==t)}}function eU(t){try{t()}catch(t){console.error(t)}}class eO extends Event{get detail(){return e_(this,tx,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw Error("preventDefault cannot be called")}stopImmediatePropagation(){throw Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw Error("stopPropagation cannot be called")}constructor(t){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),tx.set(this,void 0),eB(this,tx,t,"f")}}tx=new WeakMap;var eW=r(35074);function ez(t){let e=(0,eW.useRef)(void 0);return void 0===e.current&&(e.current={value:t()}),e.current.value}function eN(t){return t.filter(ek).map(t=>new ex({wallet:t}))}(a=t_||(t_={}))[a.DESKTOP_WEB=0]="DESKTOP_WEB",a[a.MOBILE_WEB=1]="MOBILE_WEB";var ej=r(83114);class eK extends tT.m7{constructor(){super(...arguments),this.name="WalletNotSelectedError"}}var eq=r(23515);function eD(t){let{children:e,wallets:r,adapter:n,isUnloadingRef:i,onAutoConnectRequest:o,onConnectError:s,onError:a,onSelectWallet:u}=t,l=(0,eW.useRef)(!1),[c,h]=(0,eW.useState)(!1),f=(0,eW.useRef)(!1),[d,p]=(0,eW.useState)(!1),[g,m]=(0,eW.useState)(()=>{var t;return null!=(t=null==n?void 0:n.publicKey)?t:null}),[y,w]=(0,eW.useState)(()=>{var t;return null!=(t=null==n?void 0:n.connected)&&t}),b=(0,eW.useRef)(a);(0,eW.useEffect)(()=>(b.current=a,()=>{b.current=void 0}),[a]);let v=(0,eW.useRef)((t,e)=>(!i.current&&(b.current?b.current(t,e):(console.error(t,e),t instanceof tT.AE&&"undefined"!=typeof window&&e&&window.open(e.url,"_blank"))),t)),[k,S]=(0,eW.useState)(()=>r.map(t=>({adapter:t,readyState:t.readyState})).filter(t=>{let{readyState:e}=t;return e!==tB.Ok.Unsupported}));(0,eW.useEffect)(()=>{function t(t){S(e=>{let r=e.findIndex(t=>{let{adapter:e}=t;return e===this});if(-1===r)return e;let{adapter:n}=e[r];return[...e.slice(0,r),{adapter:n,readyState:t},...e.slice(r+1)].filter(t=>{let{readyState:e}=t;return e!==tB.Ok.Unsupported})})}return S(t=>r.map((e,r)=>{let n=t[r];return n&&n.adapter===e&&n.readyState===e.readyState?n:{adapter:e,readyState:e.readyState}}).filter(t=>{let{readyState:e}=t;return e!==tB.Ok.Unsupported})),r.forEach(e=>e.on("readyStateChange",t,e)),()=>{r.forEach(e=>e.off("readyStateChange",t,e))}},[n,r]);let E=(0,eW.useMemo)(()=>{var t;return null!=(t=k.find(t=>t.adapter===n))?t:null},[n,k]);(0,eW.useEffect)(()=>{if(!n)return;let t=t=>{m(t),l.current=!1,h(!1),w(!0),f.current=!1,p(!1)},e=()=>{i.current||(m(null),l.current=!1,h(!1),w(!1),f.current=!1,p(!1))},r=t=>{v.current(t,n)};return n.on("connect",t),n.on("disconnect",e),n.on("error",r),()=>{n.off("connect",t),n.off("disconnect",e),n.off("error",r),e()}},[n,i]);let M=(0,eW.useRef)(!1);(0,eW.useEffect)(()=>()=>{M.current=!1},[n]),(0,eW.useEffect)(()=>{M.current||l.current||y||!o||(null==E?void 0:E.readyState)!==tB.Ok.Installed&&(null==E?void 0:E.readyState)!==tB.Ok.Loadable||(l.current=!0,h(!0),M.current=!0,async function(){try{await o()}catch{s()}finally{h(!1),l.current=!1}}())},[y,o,s,E]);let A=(0,eW.useCallback)(async(t,e,r)=>{if(!n)throw v.current(new eK);if(!y)throw v.current(new tT.kW,n);return await n.sendTransaction(t,e,r)},[n,y]),I=(0,eW.useMemo)(()=>n&&"signTransaction"in n?async t=>{if(!y)throw v.current(new tT.kW,n);return await n.signTransaction(t)}:void 0,[n,y]),x=(0,eW.useMemo)(()=>n&&"signAllTransactions"in n?async t=>{if(!y)throw v.current(new tT.kW,n);return await n.signAllTransactions(t)}:void 0,[n,y]),_=(0,eW.useMemo)(()=>n&&"signMessage"in n?async t=>{if(!y)throw v.current(new tT.kW,n);return await n.signMessage(t)}:void 0,[n,y]),B=(0,eW.useMemo)(()=>n&&"signIn"in n?async t=>await n.signIn(t):void 0,[n]),T=(0,eW.useCallback)(async()=>{if(l.current||f.current||(null==E?void 0:E.adapter.connected))return;if(!E)throw v.current(new eK);let{adapter:t,readyState:e}=E;if(e!==tB.Ok.Installed&&e!==tB.Ok.Loadable)throw v.current(new tT.AE,t);l.current=!0,h(!0);try{await t.connect()}catch(t){throw s(),t}finally{h(!1),l.current=!1}},[s,E]),C=(0,eW.useCallback)(async()=>{if(!f.current&&n){f.current=!0,p(!0);try{await n.disconnect()}finally{p(!1),f.current=!1}}},[n]);return eW.createElement(eq.b.Provider,{value:{autoConnect:!!o,wallets:k,wallet:E,publicKey:g,connected:y,connecting:c,disconnecting:d,select:u,connect:T,disconnect:C,sendTransaction:A,signTransaction:I,signAllTransactions:x,signMessage:_,signIn:B}},e)}function eF(t){return function(t){let{adapters:e,userAgentString:r}=t;return e.some(t=>t.name!==ei&&t.readyState===tB.Ok.Installed)?t_.DESKTOP_WEB:r&&/android/i.test(r)&&!/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(r)?t_.MOBILE_WEB:t_.DESKTOP_WEB}({adapters:t,userAgentString:function(){if(void 0===o){var t,e;o=null!=(e=null==(t=globalThis.navigator)?void 0:t.userAgent)?e:null}return o}()})===t_.MOBILE_WEB}function eH(t){let e,r,n,{children:i,wallets:o,autoConnect:a,localStorageKey:u="walletName",onError:l}=t,{connection:c}=(0,ej.w)(),h=function(t){var e;let r,n=ez(()=>new Set),{get:i,on:o}=ez(()=>(function(){if(s||(s=function(){if(s||(s=Object.freeze({register:eR,get:eP,on:eL}),"undefined"==typeof window))return s;let t=Object.freeze({register:eR});try{window.addEventListener("wallet-standard:register-wallet",e=>{let{detail:r}=e;return r(t)})}catch(t){console.error("wallet-standard:register-wallet event listener could not be added\n",t)}try{window.dispatchEvent(new eO(t))}catch(t){console.error("wallet-standard:app-ready event could not be dispatched\n",t)}return s}(),"undefined"==typeof window))return s;let t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),s;let{register:e}=s,r=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach(t=>eU(()=>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"),s}return r(...t),s})()),[a,u]=(0,eW.useState)(()=>eN(i()));(0,eW.useEffect)(()=>{let t=[o("register",function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return u(t=>[...t,...eN(e)])}),o("unregister",function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return u(t=>t.filter(t=>e.some(e=>e===t.wallet)))})];return()=>t.forEach(t=>t())},[o]);let l=(e=a,r=(0,eW.useRef)(void 0),(0,eW.useEffect)(()=>{r.current=e}),r.current);return(0,eW.useEffect)(()=>{if(!l)return;let t=new Set(a);new Set(l.filter(e=>!t.has(e))).forEach(t=>t.destroy())},[l,a]),(0,eW.useEffect)(()=>()=>a.forEach(t=>t.destroy()),[]),(0,eW.useMemo)(()=>[...a,...t.filter(t=>{let{name:e}=t;return!a.some(t=>t.name===e)||(n.has(e)||(n.add(e),console.warn("".concat(e," was registered as a Standard Wallet. The Wallet Adapter for ").concat(e," can be removed from your app."))),!1)})],[a,t,n])}(o),f=(0,eW.useMemo)(()=>{var t;if(!eF(h))return null;let e=h.find(t=>t.name===ei);return e?e:new eb({addressSelector:{select(t){return eh(this,void 0,void 0,function*(){return t[0]})}},appIdentity:{uri:function(){let t=globalThis.location;if(t)return"".concat(t.protocol,"//").concat(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(ec)}catch(t){}})},get(){return t9(this,void 0,void 0,function*(){if(t)try{let e=JSON.parse(t.getItem(ec));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(ec,JSON.stringify(e))}catch(t){}})}}}(),cluster:(t=null==c?void 0:c.rpcEndpoint)?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta",onWalletNotFound:ev})},[h,null==c?void 0:c.rpcEndpoint]),d=(0,eW.useMemo)(()=>null==f||-1!==h.indexOf(f)?h:[f,...h],[h,f]),[p,g]=(r=(e=(0,eW.useState)(()=>{try{let t=localStorage.getItem(u);if(t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&console.error(t)}return null}))[0],n=(0,eW.useRef)(!0),(0,eW.useEffect)(()=>{if(n.current){n.current=!1;return}try{null===r?localStorage.removeItem(u):localStorage.setItem(u,JSON.stringify(r))}catch(t){"undefined"!=typeof window&&console.error(t)}},[r,u]),e),m=(0,eW.useMemo)(()=>{var t;return null!=(t=d.find(t=>t.name===p))?t:null},[d,p]),y=(0,eW.useCallback)(t=>{p!==t&&(m&&m.name!==ei&&m.disconnect(),g(t))},[m,g,p]);(0,eW.useEffect)(()=>{if(m)return m.on("disconnect",t),()=>{m.off("disconnect",t)};function t(){v.current||g(null)}},[m,h,g,p]);let w=(0,eW.useRef)(!1),b=(0,eW.useMemo)(()=>{if(a&&m)return async()=>{(!0===a||await a(m))&&(w.current?await m.connect():await m.autoConnect())}},[a,m]),v=(0,eW.useRef)(!1);(0,eW.useEffect)(()=>{if(p===ei&&eF(h)){v.current=!1;return}function t(){v.current=!0}return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[h,p]);let k=(0,eW.useCallback)(()=>{m&&y(null)},[m,y]),S=(0,eW.useCallback)(t=>{w.current=!0,y(t)},[y]);return eW.createElement(eD,{wallets:d,adapter:m,isUnloadingRef:v,onAutoConnectRequest:b,onConnectError:k,onError:l,onSelectWallet:S},i)}},83114:function(t,e,r){"use strict";r.d(e,{E:()=>i,w:()=>o});var n=r(35074);let i=(0,n.createContext)({});function o(){return(0,n.useContext)(i)}},23515:function(t,e,r){"use strict";r.d(e,{b:()=>a,v:()=>u}),r(50036),r(98114);var n=r(35074);let i=[],o={autoConnect:!1,connecting:!1,connected:!1,disconnecting:!1,select(){s("call","select")},connect:()=>Promise.reject(s("call","connect")),disconnect:()=>Promise.reject(s("call","disconnect")),sendTransaction:()=>Promise.reject(s("call","sendTransaction")),signTransaction:()=>Promise.reject(s("call","signTransaction")),signAllTransactions:()=>Promise.reject(s("call","signAllTransactions")),signMessage:()=>Promise.reject(s("call","signMessage")),signIn:()=>Promise.reject(s("call","signIn"))};function s(t,e){let r=Error("You have tried to ".concat(t,' "').concat(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(o,"wallets",{get:()=>(s("read","wallets"),i)}),Object.defineProperty(o,"wallet",{get:()=>(s("read","wallet"),null)}),Object.defineProperty(o,"publicKey",{get:()=>(s("read","publicKey"),null)});let a=(0,n.createContext)(o);function u(){return(0,n.useContext)(a)}},41899:function(t,e,r){"use strict";r.d(e,{CE:()=>n,g4:()=>s,re:()=>o,sE:()=>i}),r(30945);let n="solana:mainnet",i="solana:devnet",o="solana:testnet",s="solana:localnet"},26137:function(t,e,r){"use strict";r.d(e,{GZ:()=>o,RU:()=>i}),r(30945),r(22501);var n=r(41899);let i="https://api.mainnet-beta.solana.com";function o(t){return t.includes(i)?n.CE:/\bdevnet\b/i.test(t)?n.sE:/\btestnet\b/i.test(t)?n.re:/\blocalhost\b/i.test(t)||/\b127\.0\.0\.1\b/.test(t)?n.g4:n.CE}}}]);