UNPKG

kana-widget-v2

Version:

Kana Widget for cross-chain bridging and swap.

10 lines 1.56 MB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const D=require("react/jsx-runtime"),es=require("@solana/wallet-adapter-react"),Yn=require("@solana/wallet-adapter-wallets"),ye=require("react"),R=require("@kanalabs/aggregator"),Vr=require("antd"),l6=require("fewcha-plugin-wallet-adapter"),c6=require("@pontem/wallet-adapter-plugin"),u6=require("@rise-wallet/wallet-adapter"),d6=require("@martianwallet/aptos-wallet-adapter"),h6=require("petra-plugin-wallet-adapter"),pa=require("aptos"),Fe=require("@aptos-labs/ts-sdk"),Zi=require("axios"),p6=require("@mizuwallet-sdk/aptos-wallet-adapter"),wi=require("@tanstack/react-query"),m6=require("@tanstack/react-query-devtools"),Mg=require("react-i18next"),Pn=require("@mysten/sui.js"),Cn=require("@solana/web3.js"),tr=require("ethers"),J0=require("@apollo/client"),Xr=require("wagmi"),er=require("@wagmi/core"),hd=require("zustand"),v6=require("zustand/middleware"),g6=require("zustand/middleware/immer"),b6=require("react-dom"),w6=require("react-responsive"),pd=require("react-spinners"),jf=require("react-select"),Cs=require("wagmi/chains"),y6=require("wagmi/providers/public"),x6=require("wagmi/connectors/coinbaseWallet"),A6=require("wagmi/connectors/metaMask");function k6(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const f in t)if(f!=="default"){const o=Object.getOwnPropertyDescriptor(t,f);Object.defineProperty(a,f,o.get?o:{enumerable:!0,get:()=>t[f]})}}return a.default=t,Object.freeze(a)}const Pr=k6(ye),ma="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2051%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='25.682'%20cy='25'%20fill='%23000'%20r='25'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M14.39%2012.317c.209-.2.484-.317.768-.317h26.476c.483%200%20.725.584.383.926l-5.23%205.23c-.2.2-.475.317-.767.317H9.544a.542.542%200%200%201-.384-.926l5.23-5.23Zm0%2019.527c.2-.2.476-.317.768-.317h26.476c.483%200%20.725.584.383.926l-5.23%205.23c-.2.2-.475.317-.767.317H9.544a.542.542%200%200%201-.384-.926l5.23-5.23ZM36.02%2021.7c.292%200%20.567.117.767.317l5.23%205.23c.342.342.1.926-.384.926H15.158c-.292%200-.567-.117-.768-.317l-5.23-5.23a.542.542%200%200%201%20.384-.926H36.02Z'%20fill='url(%23a)'/%3e%3cdefs%3e%3clinearGradient%20id='a'%20x1='35.073'%20y1='6.771'%20x2='16.749'%20y2='41.868'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2300FFA3'/%3e%3cstop%20offset='1'%20stop-color='%23DC1FFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",yi="data:image/svg+xml,%3csvg%20id='aptos-icon'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2074.67%2074.96'%20class='w-28'%3e%3ccircle%20cx='37.335'%20cy='37.48'%20r='37.335'%20fill='white'%3e%3c/circle%3e%3cpath%20d='M57.84,25.08H51.23a2.67,2.67,0,0,1-2-.91l-2.68-3a2.12,2.12,0,0,0-3.15,0l-2.3,2.6a4,4,0,0,1-3,1.34H2a37.24,37.24,0,0,0-2,9.25H34.13a2.21,2.21,0,0,0,1.59-.68l3.18-3.32a2.13,2.13,0,0,1,1.52-.64h.13a2.05,2.05,0,0,1,1.57.71l2.68,3a2.69,2.69,0,0,0,2,.91H74.67a36.79,36.79,0,0,0-2-9.25H57.84Z'%3e%3c/path%3e%3cpath%20d='M20.65,53.78a2.17,2.17,0,0,0,1.59-.68l3.18-3.31a2.1,2.1,0,0,1,1.52-.65h.13a2.12,2.12,0,0,1,1.58.71l2.68,3a2.7,2.7,0,0,0,2,.9H71.09a37.09,37.09,0,0,0,3.07-9.34H37.92a2.67,2.67,0,0,1-2-.91l-2.68-3a2.1,2.1,0,0,0-3.15,0l-2.3,2.59a4,4,0,0,1-3,1.34H.51a37.5,37.5,0,0,0,3.07,9.34Z'%3e%3c/path%3e%3cpath%20d='M47.44,15A2.23,2.23,0,0,0,49,14.29L52.21,11a2.09,2.09,0,0,1,1.52-.64h.13a2.09,2.09,0,0,1,1.57.7l2.68,3a2.67,2.67,0,0,0,2,.91H67.3A37.48,37.48,0,0,0,7.37,15Z'%3e%3c/path%3e%3cpath%20d='M33,63H23.2a2.7,2.7,0,0,1-2-.9l-2.68-3a2.1,2.1,0,0,0-3.15,0l-2.3,2.6a4,4,0,0,1-3,1.33H9.94a37.44,37.44,0,0,0,54.79,0Z'%3e%3c/path%3e%3c/svg%3e",Fn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='60'%20height='60'%20fill='none'%20viewBox='0%200%2060%2060'%3e%3cpath%20cx='512'%20cy='512'%20r='512'%20fill='%238247E5'%20d='M60%2030A30%2030%200%200%201%2030%2060A30%2030%200%200%201%200%2030A30%2030%200%200%201%2060%2030z'/%3e%3cpath%20fill='%23fff'%20d='M39.93%2023.581c-0.72%20-0.419%20-1.655%20-0.419%20-2.446%200l-5.613%203.209%20-3.814%202.093%20-5.613%203.209c-0.72%200.419%20-1.655%200.419%20-2.447%200l-4.461%20-2.512c-0.72%20-0.419%20-1.223%20-1.186%20-1.223%20-2.023v-4.953c0%20-0.837%200.432%20-1.605%201.223%20-2.023l4.389%20-2.442c0.72%20-0.419%201.655%20-0.419%202.447%200l4.389%202.442c0.72%200.419%201.223%201.186%201.223%202.023v3.209l3.814%20-2.163v-3.209c0%20-0.837%20-0.432%20-1.605%20-1.223%20-2.023l-8.131%20-4.605c-0.72%20-0.419%20-1.655%20-0.419%20-2.447%200l-8.275%204.605c-0.792%200.419%20-1.223%201.186%20-1.223%202.023v9.279c0%200.837%200.432%201.605%201.223%202.023l8.275%204.605c0.72%200.419%201.655%200.419%202.447%200l5.613%20-3.14%203.814%20-2.163%205.613%20-3.14c0.72%20-0.419%201.655%20-0.419%202.446%200l4.389%202.442c0.72%200.419%201.223%201.186%201.223%202.023v4.953c0%200.837%20-0.432%201.605%20-1.223%202.023l-4.389%202.512c-0.72%200.419%20-1.655%200.419%20-2.446%200l-4.389%20-2.442c-0.72%20-0.419%20-1.223%20-1.186%20-1.223%20-2.023v-3.209l-3.814%202.163v3.209c0%200.837%200.432%201.605%201.223%202.023l8.275%204.605c0.72%200.419%201.655%200.419%202.446%200l8.275%20-4.605c0.72%20-0.419%201.223%20-1.186%201.223%20-2.023V30.279c0%20-0.837%20-0.432%20-1.605%20-1.223%20-2.023l-8.347%20-4.674Z'/%3e%3c/svg%3e",M6="https://api.mainnet-beta.solana.com";R.NetworkId.solana,R.NetworkId.aptos,R.NetworkId.polygon;var tt=(t=>(t.Success="success",t.Error="error",t.Info="info",t.Warning="warning",t.Open="open",t))(tt||{});const of=()=>{const[t,a]=Vr.notification.useNotification();return{showNotification:(o,c)=>{const{message:i,description:h,duration:p}=c;t[o]({message:i,description:h,duration:p,placement:"bottomRight"})},contextHolder:a}},S6=t=>{const{showNotification:a,contextHolder:f}=of(),o=ye.useMemo(()=>[new Yn.PhantomWalletAdapter,new Yn.SolflareWalletAdapter,new Yn.NightlyWalletAdapter,new Yn.CloverWalletAdapter,new Yn.Coin98WalletAdapter,new Yn.SolongWalletAdapter,new Yn.TorusWalletAdapter],[]);return D.jsx(D.Fragment,{children:D.jsxs(Vr.ConfigProvider,{theme:{components:{Notification:{borderRadiusLG:20,colorText:"rgba(255, 255, 255, 0.88)",colorTextHeading:"rgba(255, 255, 255, 0.88)",colorIcon:"rgba(255, 255, 255, 0.45)",colorBgElevated:"rgb(23, 24, 26)",colorIconHover:"rgba(255, 255, 255, 0.88)"}}},children:[f,D.jsx(es.ConnectionProvider,{endpoint:M6,children:D.jsx(es.WalletProvider,{wallets:o,autoConnect:!0,onError:c=>{if(c.toString()==="WalletSignTransactionError: User rejected the request."||c.toString()==="WalletSignTransactionError: Approval Denied"||c.toString()==="WalletSignTransactionError: Failed to sign transaction"||c.toString()==="WalletSignTransactionError: You canceled the transaction.")throw new Error("User Rejected the request");(c.toString()==="WalletConnectionError: User rejected the request."||c.name==="WalletConnectionError"||c.name==="WalletAccountError"||c.toString()==="WalletConnectionError: You canceled this request.")&&a(tt.Error,{message:"User has rejected the connection"})},children:t==null?void 0:t.children})})]})})};var lr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function md(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function E6(t){if(t.__esModule)return t;var a=t.default;if(typeof a=="function"){var f=function o(){return this instanceof o?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};f.prototype=a.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var c=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(f,o,c.get?c:{enumerable:!0,get:function(){return t[o]}})}),f}var Ff={exports:{}},A1;function N6(){return A1||(A1=1,function(t){var a=Object.prototype.hasOwnProperty,f="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(f=!1));function c(g,w,m){this.fn=g,this.context=w,this.once=m||!1}function i(g,w,m,A,k){if(typeof m!="function")throw new TypeError("The listener must be a function");var M=new c(m,A||g,k),S=f?f+w:w;return g._events[S]?g._events[S].fn?g._events[S]=[g._events[S],M]:g._events[S].push(M):(g._events[S]=M,g._eventsCount++),g}function h(g,w){--g._eventsCount===0?g._events=new o:delete g._events[w]}function p(){this._events=new o,this._eventsCount=0}p.prototype.eventNames=function(){var w=[],m,A;if(this._eventsCount===0)return w;for(A in m=this._events)a.call(m,A)&&w.push(f?A.slice(1):A);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(m)):w},p.prototype.listeners=function(w){var m=f?f+w:w,A=this._events[m];if(!A)return[];if(A.fn)return[A.fn];for(var k=0,M=A.length,S=new Array(M);k<M;k++)S[k]=A[k].fn;return S},p.prototype.listenerCount=function(w){var m=f?f+w:w,A=this._events[m];return A?A.fn?1:A.length:0},p.prototype.emit=function(w,m,A,k,M,S){var E=f?f+w:w;if(!this._events[E])return!1;var B=this._events[E],C=arguments.length,P,F;if(B.fn){switch(B.once&&this.removeListener(w,B.fn,void 0,!0),C){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,m),!0;case 3:return B.fn.call(B.context,m,A),!0;case 4:return B.fn.call(B.context,m,A,k),!0;case 5:return B.fn.call(B.context,m,A,k,M),!0;case 6:return B.fn.call(B.context,m,A,k,M,S),!0}for(F=1,P=new Array(C-1);F<C;F++)P[F-1]=arguments[F];B.fn.apply(B.context,P)}else{var q=B.length,ie;for(F=0;F<q;F++)switch(B[F].once&&this.removeListener(w,B[F].fn,void 0,!0),C){case 1:B[F].fn.call(B[F].context);break;case 2:B[F].fn.call(B[F].context,m);break;case 3:B[F].fn.call(B[F].context,m,A);break;case 4:B[F].fn.call(B[F].context,m,A,k);break;default:if(!P)for(ie=1,P=new Array(C-1);ie<C;ie++)P[ie-1]=arguments[ie];B[F].fn.apply(B[F].context,P)}}return!0},p.prototype.on=function(w,m,A){return i(this,w,m,A,!1)},p.prototype.once=function(w,m,A){return i(this,w,m,A,!0)},p.prototype.removeListener=function(w,m,A,k){var M=f?f+w:w;if(!this._events[M])return this;if(!m)return h(this,M),this;var S=this._events[M];if(S.fn)S.fn===m&&(!k||S.once)&&(!A||S.context===A)&&h(this,M);else{for(var E=0,B=[],C=S.length;E<C;E++)(S[E].fn!==m||k&&!S[E].once||A&&S[E].context!==A)&&B.push(S[E]);B.length?this._events[M]=B.length===1?B[0]:B:h(this,M)}return this},p.prototype.removeAllListeners=function(w){var m;return w?(m=f?f+w:w,this._events[m]&&h(this,m)):(this._events=new o,this._eventsCount=0),this},p.prototype.off=p.prototype.removeListener,p.prototype.addListener=p.prototype.on,p.prefixed=f,p.EventEmitter=p,t.exports=p}(Ff)),Ff.exports}var I6=N6();const Sg=md(I6);var C6="aptos:signAndSubmitTransaction",B6="aptos:signMessage",P6="aptos:signTransaction",R6="aptos:connect",D6="aptos:disconnect",T6="aptos:account",L6="aptos:network",j6="aptos:onAccountChange",F6="aptos:onNetworkChange",Eg=class Ng extends Fe.Serializable{constructor({address:a,publicKey:f,ansName:o}){super(),this.address=Fe.AccountAddress.from(a),this.publicKey=f,this.ansName=o}serialize(a){if(this.address.serialize(a),this.publicKey instanceof Fe.Ed25519PublicKey)a.serializeU32AsUleb128(Fe.SigningScheme.Ed25519);else if(this.publicKey instanceof Fe.MultiEd25519PublicKey)a.serializeU32AsUleb128(Fe.SigningScheme.MultiEd25519);else if(this.publicKey instanceof Fe.AnyPublicKey)a.serializeU32AsUleb128(Fe.SigningScheme.SingleKey);else if(this.publicKey instanceof Fe.MultiKey)a.serializeU32AsUleb128(Fe.SigningScheme.MultiKey);else throw new Error("Unsupported public key");this.publicKey.serialize(a),a.serializeStr(this.ansName??"")}static deserialize(a){let f=Fe.AccountAddress.deserialize(a),o=a.deserializeUleb128AsU32(),c;switch(o){case Fe.SigningScheme.Ed25519:c=Fe.Ed25519PublicKey.deserialize(a);break;case Fe.SigningScheme.MultiEd25519:c=Fe.MultiEd25519PublicKey.deserialize(a);break;case Fe.SigningScheme.SingleKey:c=Fe.AnyPublicKey.deserialize(a);break;case Fe.SigningScheme.MultiKey:c=Fe.MultiKey.deserialize(a);break;default:throw new Error(`Unknown variant index for WrappedPublicKey: ${o}`)}let i=a.deserializeStr()||void 0;return new Ng({address:f,publicKey:c,ansName:i})}},O6="aptos:devnet",z6="aptos:testnet",U6="aptos:localnet",q6="aptos:mainnet",Ig=[O6,z6,U6,q6],J6=function(t,a,f,o){if(f==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof a=="function"?t!==a||!o:!a.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?o:f==="a"?o.call(t):o?o.value:a.get(t)},H6=function(t,a,f,o,c){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof a=="function"?t!==a||!c:!a.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?c.call(t,f):c?c.value=f:a.set(t,f),f},g0;let Bs;const ff=new Set;function V6(t){Hs=void 0,ff.add(t)}function W6(t){Hs=void 0,ff.delete(t)}const Za={};function Cg(){if(Bs||(Bs=Object.freeze({register:k1,get:_6,on:G6}),typeof window>"u"))return Bs;const t=Object.freeze({register:k1});try{window.addEventListener("wallet-standard:register-wallet",({detail:a})=>a(t))}catch(a){console.error(`wallet-standard:register-wallet event listener could not be added `,a)}try{window.dispatchEvent(new K6(t))}catch(a){console.error(`wallet-standard:app-ready event could not be dispatched `,a)}return Bs}function k1(...t){var a;return t=t.filter(f=>!ff.has(f)),t.length?(t.forEach(f=>V6(f)),(a=Za.register)==null||a.forEach(f=>M1(()=>f(...t))),function(){var o;t.forEach(c=>W6(c)),(o=Za.unregister)==null||o.forEach(c=>M1(()=>c(...t)))}):()=>{}}let Hs;function _6(){return Hs||(Hs=[...ff]),Hs}function G6(t,a){var f;return(f=Za[t])!=null&&f.push(a)||(Za[t]=[a]),function(){var c;Za[t]=(c=Za[t])==null?void 0:c.filter(i=>a!==i)}}function M1(t){try{t()}catch(a){console.error(a)}}class K6 extends Event{get detail(){return J6(this,g0,"f")}get type(){return"wallet-standard:app-ready"}constructor(a){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),g0.set(this,void 0),H6(this,g0,a,"f")}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}g0=new WeakMap;function Z6(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bg={exports:{}},jr=Bg.exports={},Vi,Wi;function Ru(){throw new Error("setTimeout has not been defined")}function Du(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Vi=setTimeout:Vi=Ru}catch{Vi=Ru}try{typeof clearTimeout=="function"?Wi=clearTimeout:Wi=Du}catch{Wi=Du}})();function Pg(t){if(Vi===setTimeout)return setTimeout(t,0);if((Vi===Ru||!Vi)&&setTimeout)return Vi=setTimeout,setTimeout(t,0);try{return Vi(t,0)}catch{try{return Vi.call(null,t,0)}catch{return Vi.call(this,t,0)}}}function X6(t){if(Wi===clearTimeout)return clearTimeout(t);if((Wi===Du||!Wi)&&clearTimeout)return Wi=clearTimeout,clearTimeout(t);try{return Wi(t)}catch{try{return Wi.call(null,t)}catch{return Wi.call(this,t)}}}var mn=[],Qa=!1,la,b0=-1;function Y6(){!Qa||!la||(Qa=!1,la.length?mn=la.concat(mn):b0=-1,mn.length&&Rg())}function Rg(){if(!Qa){var t=Pg(Y6);Qa=!0;for(var a=mn.length;a;){for(la=mn,mn=[];++b0<a;)la&&la[b0].run();b0=-1,a=mn.length}la=null,Qa=!1,X6(t)}}jr.nextTick=function(t){var a=new Array(arguments.length-1);if(arguments.length>1)for(var f=1;f<arguments.length;f++)a[f-1]=arguments[f];mn.push(new Dg(t,a)),mn.length===1&&!Qa&&Pg(Rg)};function Dg(t,a){this.fun=t,this.array=a}Dg.prototype.run=function(){this.fun.apply(null,this.array)};jr.title="browser";jr.browser=!0;jr.env={};jr.argv=[];jr.version="";jr.versions={};function An(){}jr.on=An;jr.addListener=An;jr.once=An;jr.off=An;jr.removeListener=An;jr.removeAllListeners=An;jr.emit=An;jr.prependListener=An;jr.prependOnceListener=An;jr.listeners=function(t){return[]};jr.binding=function(t){throw new Error("process.binding is not supported")};jr.cwd=function(){return"/"};jr.chdir=function(t){throw new Error("process.chdir is not supported")};jr.umask=function(){return 0};var Q6=Bg.exports;const Ut=Z6(Q6);var $6=function(t,a,f,o){if(f==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof a=="function"?t!==a||!o:!a.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?o:f==="a"?o.call(t):o?o.value:a.get(t)},e4=function(t,a,f,o,c){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof a=="function"?t!==a||!c:!a.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?c.call(t,f):c?c.value=f:a.set(t,f),f},w0;function t4(t){const a=({register:f})=>f(t);try{window.dispatchEvent(new r4(a))}catch(f){console.error(`wallet-standard:register-wallet event could not be dispatched `,f)}try{window.addEventListener("wallet-standard:app-ready",({detail:f})=>a(f))}catch(f){console.error(`wallet-standard:app-ready event listener could not be added `,f)}}class r4 extends Event{get detail(){return $6(this,w0,"f")}get type(){return"wallet-standard:register-wallet"}constructor(a){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),w0.set(this,void 0),e4(this,w0,a,"f")}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}w0=new WeakMap;var ja=function(t,a,f,o){if(f==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof a=="function"?t!==a||!o:!a.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?o:f==="a"?o.call(t):o?o.value:a.get(t)},Fa=function(t,a,f,o,c){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof a=="function"?t!==a||!c:!a.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?c.call(t,f):c?c.value=f:a.set(t,f),f},y0,x0,A0,k0,M0,S0;class vd{get address(){return ja(this,y0,"f")}get publicKey(){return ja(this,x0,"f").slice()}get chains(){return ja(this,A0,"f").slice()}get features(){return ja(this,k0,"f").slice()}get label(){return ja(this,M0,"f")}get icon(){return ja(this,S0,"f")}constructor(a){y0.set(this,void 0),x0.set(this,void 0),A0.set(this,void 0),k0.set(this,void 0),M0.set(this,void 0),S0.set(this,void 0),new.target===vd&&Object.freeze(this),Fa(this,y0,a.address,"f"),Fa(this,x0,a.publicKey.slice(),"f"),Fa(this,A0,a.chains.slice(),"f"),Fa(this,k0,a.features.slice(),"f"),Fa(this,M0,a.label,"f"),Fa(this,S0,a.icon,"f")}}y0=new WeakMap,x0=new WeakMap,A0=new WeakMap,k0=new WeakMap,M0=new WeakMap,S0=new WeakMap;var i4=["aptos:account","aptos:connect","aptos:disconnect","aptos:network","aptos:onAccountChange","aptos:onNetworkChange","aptos:signMessage","aptos:signTransaction"];function Tg(t,a=[]){return[...i4,...a].every(f=>f in t.features)}function Of(){let{get:t,on:a}=Cg(),f=t(),o=[];return f.map(c=>{Tg(c)&&o.push(c)}),{aptosWallets:o,on:a}}var Fs=(t=>(t[t.Unauthorized=4100]="Unauthorized",t[t.InternalError=-30001]="InternalError",t))(Fs||{}),S1=Object.freeze({4100:{status:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[-30001]:{status:"Internal error",message:"Something went wrong within the wallet."}}),Uo=class Lg extends Error{constructor(a,f){var o,c;super(f??((o=S1[a])==null?void 0:o.message)??"Unknown error occurred"),this.code=a,this.status=((c=S1[a])==null?void 0:c.status)??"Unknown error",this.name="AptosWalletError",Object.setPrototypeOf(this,Lg.prototype)}},Hr=(t=>(t.APPROVED="Approved",t.REJECTED="Rejected",t))(Hr||{}),gd={},lf={};lf.byteLength=s4;lf.toByteArray=f4;lf.fromByteArray=u4;var Ki=[],Bi=[],n4=typeof Uint8Array<"u"?Uint8Array:Array,zf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Oa=0,a4=zf.length;Oa<a4;++Oa)Ki[Oa]=zf[Oa],Bi[zf.charCodeAt(Oa)]=Oa;Bi[45]=62;Bi[95]=63;function jg(t){var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=t.indexOf("=");f===-1&&(f=a);var o=f===a?0:4-f%4;return[f,o]}function s4(t){var a=jg(t),f=a[0],o=a[1];return(f+o)*3/4-o}function o4(t,a,f){return(a+f)*3/4-f}function f4(t){var a,f=jg(t),o=f[0],c=f[1],i=new n4(o4(t,o,c)),h=0,p=c>0?o-4:o,g;for(g=0;g<p;g+=4)a=Bi[t.charCodeAt(g)]<<18|Bi[t.charCodeAt(g+1)]<<12|Bi[t.charCodeAt(g+2)]<<6|Bi[t.charCodeAt(g+3)],i[h++]=a>>16&255,i[h++]=a>>8&255,i[h++]=a&255;return c===2&&(a=Bi[t.charCodeAt(g)]<<2|Bi[t.charCodeAt(g+1)]>>4,i[h++]=a&255),c===1&&(a=Bi[t.charCodeAt(g)]<<10|Bi[t.charCodeAt(g+1)]<<4|Bi[t.charCodeAt(g+2)]>>2,i[h++]=a>>8&255,i[h++]=a&255),i}function l4(t){return Ki[t>>18&63]+Ki[t>>12&63]+Ki[t>>6&63]+Ki[t&63]}function c4(t,a,f){for(var o,c=[],i=a;i<f;i+=3)o=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),c.push(l4(o));return c.join("")}function u4(t){for(var a,f=t.length,o=f%3,c=[],i=16383,h=0,p=f-o;h<p;h+=i)c.push(c4(t,h,h+i>p?p:h+i));return o===1?(a=t[f-1],c.push(Ki[a>>2]+Ki[a<<4&63]+"==")):o===2&&(a=(t[f-2]<<8)+t[f-1],c.push(Ki[a>>10]+Ki[a>>4&63]+Ki[a<<2&63]+"=")),c.join("")}var bd={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */bd.read=function(t,a,f,o,c){var i,h,p=c*8-o-1,g=(1<<p)-1,w=g>>1,m=-7,A=f?c-1:0,k=f?-1:1,M=t[a+A];for(A+=k,i=M&(1<<-m)-1,M>>=-m,m+=p;m>0;i=i*256+t[a+A],A+=k,m-=8);for(h=i&(1<<-m)-1,i>>=-m,m+=o;m>0;h=h*256+t[a+A],A+=k,m-=8);if(i===0)i=1-w;else{if(i===g)return h?NaN:(M?-1:1)*(1/0);h=h+Math.pow(2,o),i=i-w}return(M?-1:1)*h*Math.pow(2,i-o)};bd.write=function(t,a,f,o,c,i){var h,p,g,w=i*8-c-1,m=(1<<w)-1,A=m>>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=o?0:i-1,S=o?1:-1,E=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(p=isNaN(a)?1:0,h=m):(h=Math.floor(Math.log(a)/Math.LN2),a*(g=Math.pow(2,-h))<1&&(h--,g*=2),h+A>=1?a+=k/g:a+=k*Math.pow(2,1-A),a*g>=2&&(h++,g/=2),h+A>=m?(p=0,h=m):h+A>=1?(p=(a*g-1)*Math.pow(2,c),h=h+A):(p=a*Math.pow(2,A-1)*Math.pow(2,c),h=0));c>=8;t[f+M]=p&255,M+=S,p/=256,c-=8);for(h=h<<c|p,w+=c;w>0;t[f+M]=h&255,M+=S,h/=256,w-=8);t[f+M-S]|=E*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */(function(t){const a=lf,f=bd,o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=m,t.SlowBuffer=ie,t.INSPECT_MAX_BYTES=50;const c=2147483647;t.kMaxLength=c;const{Uint8Array:i,ArrayBuffer:h,SharedArrayBuffer:p}=globalThis;m.TYPED_ARRAY_SUPPORT=g(),!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function g(){try{const Y=new i(1),j={foo:function(){return 42}};return Object.setPrototypeOf(j,i.prototype),Object.setPrototypeOf(Y,j),Y.foo()===42}catch{return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.buffer}}),Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.byteOffset}});function w(Y){if(Y>c)throw new RangeError('The value "'+Y+'" is invalid for option "size"');const j=new i(Y);return Object.setPrototypeOf(j,m.prototype),j}function m(Y,j,V){if(typeof Y=="number"){if(typeof j=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(Y)}return A(Y,j,V)}m.poolSize=8192;function A(Y,j,V){if(typeof Y=="string")return E(Y,j);if(h.isView(Y))return C(Y);if(Y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Y);if(Ge(Y,h)||Y&&Ge(Y.buffer,h)||typeof p<"u"&&(Ge(Y,p)||Y&&Ge(Y.buffer,p)))return P(Y,j,V);if(typeof Y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const oe=Y.valueOf&&Y.valueOf();if(oe!=null&&oe!==Y)return m.from(oe,j,V);const me=F(Y);if(me)return me;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Y[Symbol.toPrimitive]=="function")return m.from(Y[Symbol.toPrimitive]("string"),j,V);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Y)}m.from=function(Y,j,V){return A(Y,j,V)},Object.setPrototypeOf(m.prototype,i.prototype),Object.setPrototypeOf(m,i);function k(Y){if(typeof Y!="number")throw new TypeError('"size" argument must be of type number');if(Y<0)throw new RangeError('The value "'+Y+'" is invalid for option "size"')}function M(Y,j,V){return k(Y),Y<=0?w(Y):j!==void 0?typeof V=="string"?w(Y).fill(j,V):w(Y).fill(j):w(Y)}m.alloc=function(Y,j,V){return M(Y,j,V)};function S(Y){return k(Y),w(Y<0?0:q(Y)|0)}m.allocUnsafe=function(Y){return S(Y)},m.allocUnsafeSlow=function(Y){return S(Y)};function E(Y,j){if((typeof j!="string"||j==="")&&(j="utf8"),!m.isEncoding(j))throw new TypeError("Unknown encoding: "+j);const V=le(Y,j)|0;let oe=w(V);const me=oe.write(Y,j);return me!==V&&(oe=oe.slice(0,me)),oe}function B(Y){const j=Y.length<0?0:q(Y.length)|0,V=w(j);for(let oe=0;oe<j;oe+=1)V[oe]=Y[oe]&255;return V}function C(Y){if(Ge(Y,i)){const j=new i(Y);return P(j.buffer,j.byteOffset,j.byteLength)}return B(Y)}function P(Y,j,V){if(j<0||Y.byteLength<j)throw new RangeError('"offset" is outside of buffer bounds');if(Y.byteLength<j+(V||0))throw new RangeError('"length" is outside of buffer bounds');let oe;return j===void 0&&V===void 0?oe=new i(Y):V===void 0?oe=new i(Y,j):oe=new i(Y,j,V),Object.setPrototypeOf(oe,m.prototype),oe}function F(Y){if(m.isBuffer(Y)){const j=q(Y.length)|0,V=w(j);return V.length===0||Y.copy(V,0,0,j),V}if(Y.length!==void 0)return typeof Y.length!="number"||Bt(Y.length)?w(0):B(Y);if(Y.type==="Buffer"&&Array.isArray(Y.data))return B(Y.data)}function q(Y){if(Y>=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return Y|0}function ie(Y){return+Y!=Y&&(Y=0),m.alloc(+Y)}m.isBuffer=function(j){return j!=null&&j._isBuffer===!0&&j!==m.prototype},m.compare=function(j,V){if(Ge(j,i)&&(j=m.from(j,j.offset,j.byteLength)),Ge(V,i)&&(V=m.from(V,V.offset,V.byteLength)),!m.isBuffer(j)||!m.isBuffer(V))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(j===V)return 0;let oe=j.length,me=V.length;for(let De=0,ke=Math.min(oe,me);De<ke;++De)if(j[De]!==V[De]){oe=j[De],me=V[De];break}return oe<me?-1:me<oe?1:0},m.isEncoding=function(j){switch(String(j).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}},m.concat=function(j,V){if(!Array.isArray(j))throw new TypeError('"list" argument must be an Array of Buffers');if(j.length===0)return m.alloc(0);let oe;if(V===void 0)for(V=0,oe=0;oe<j.length;++oe)V+=j[oe].length;const me=m.allocUnsafe(V);let De=0;for(oe=0;oe<j.length;++oe){let ke=j[oe];if(Ge(ke,i))De+ke.length>me.length?(m.isBuffer(ke)||(ke=m.from(ke)),ke.copy(me,De)):i.prototype.set.call(me,ke,De);else if(m.isBuffer(ke))ke.copy(me,De);else throw new TypeError('"list" argument must be an Array of Buffers');De+=ke.length}return me};function le(Y,j){if(m.isBuffer(Y))return Y.length;if(h.isView(Y)||Ge(Y,h))return Y.byteLength;if(typeof Y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Y);const V=Y.length,oe=arguments.length>2&&arguments[2]===!0;if(!oe&&V===0)return 0;let me=!1;for(;;)switch(j){case"ascii":case"latin1":case"binary":return V;case"utf8":case"utf-8":return It(Y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V*2;case"hex":return V>>>1;case"base64":return kt(Y).length;default:if(me)return oe?-1:It(Y).length;j=(""+j).toLowerCase(),me=!0}}m.byteLength=le;function de(Y,j,V){let oe=!1;if((j===void 0||j<0)&&(j=0),j>this.length||((V===void 0||V>this.length)&&(V=this.length),V<=0)||(V>>>=0,j>>>=0,V<=j))return"";for(Y||(Y="utf8");;)switch(Y){case"hex":return N(this,j,V);case"utf8":case"utf-8":return b(this,j,V);case"ascii":return r(this,j,V);case"latin1":case"binary":return v(this,j,V);case"base64":return u(this,j,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,j,V);default:if(oe)throw new TypeError("Unknown encoding: "+Y);Y=(Y+"").toLowerCase(),oe=!0}}m.prototype._isBuffer=!0;function be(Y,j,V){const oe=Y[j];Y[j]=Y[V],Y[V]=oe}m.prototype.swap16=function(){const j=this.length;if(j%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let V=0;V<j;V+=2)be(this,V,V+1);return this},m.prototype.swap32=function(){const j=this.length;if(j%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let V=0;V<j;V+=4)be(this,V,V+3),be(this,V+1,V+2);return this},m.prototype.swap64=function(){const j=this.length;if(j%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let V=0;V<j;V+=8)be(this,V,V+7),be(this,V+1,V+6),be(this,V+2,V+5),be(this,V+3,V+4);return this},m.prototype.toString=function(){const j=this.length;return j===0?"":arguments.length===0?b(this,0,j):de.apply(this,arguments)},m.prototype.toLocaleString=m.prototype.toString,m.prototype.equals=function(j){if(!m.isBuffer(j))throw new TypeError("Argument must be a Buffer");return this===j?!0:m.compare(this,j)===0},m.prototype.inspect=function(){let j="";const V=t.INSPECT_MAX_BYTES;return j=this.toString("hex",0,V).replace(/(.{2})/g,"$1 ").trim(),this.length>V&&(j+=" ... "),"<Buffer "+j+">"},o&&(m.prototype[o]=m.prototype.inspect),m.prototype.compare=function(j,V,oe,me,De){if(Ge(j,i)&&(j=m.from(j,j.offset,j.byteLength)),!m.isBuffer(j))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof j);if(V===void 0&&(V=0),oe===void 0&&(oe=j?j.length:0),me===void 0&&(me=0),De===void 0&&(De=this.length),V<0||oe>j.length||me<0||De>this.length)throw new RangeError("out of range index");if(me>=De&&V>=oe)return 0;if(me>=De)return-1;if(V>=oe)return 1;if(V>>>=0,oe>>>=0,me>>>=0,De>>>=0,this===j)return 0;let ke=De-me,Je=oe-V;const Et=Math.min(ke,Je),Ue=this.slice(me,De),Le=j.slice(V,oe);for(let rt=0;rt<Et;++rt)if(Ue[rt]!==Le[rt]){ke=Ue[rt],Je=Le[rt];break}return ke<Je?-1:Je<ke?1:0};function ae(Y,j,V,oe,me){if(Y.length===0)return-1;if(typeof V=="string"?(oe=V,V=0):V>2147483647?V=2147483647:V<-2147483648&&(V=-2147483648),V=+V,Bt(V)&&(V=me?0:Y.length-1),V<0&&(V=Y.length+V),V>=Y.length){if(me)return-1;V=Y.length-1}else if(V<0)if(me)V=0;else return-1;if(typeof j=="string"&&(j=m.from(j,oe)),m.isBuffer(j))return j.length===0?-1:G(Y,j,V,oe,me);if(typeof j=="number")return j=j&255,typeof i.prototype.indexOf=="function"?me?i.prototype.indexOf.call(Y,j,V):i.prototype.lastIndexOf.call(Y,j,V):G(Y,[j],V,oe,me);throw new TypeError("val must be string, number or Buffer")}function G(Y,j,V,oe,me){let De=1,ke=Y.length,Je=j.length;if(oe!==void 0&&(oe=String(oe).toLowerCase(),oe==="ucs2"||oe==="ucs-2"||oe==="utf16le"||oe==="utf-16le")){if(Y.length<2||j.length<2)return-1;De=2,ke/=2,Je/=2,V/=2}function Et(Le,rt){return De===1?Le[rt]:Le.readUInt16BE(rt*De)}let Ue;if(me){let Le=-1;for(Ue=V;Ue<ke;Ue++)if(Et(Y,Ue)===Et(j,Le===-1?0:Ue-Le)){if(Le===-1&&(Le=Ue),Ue-Le+1===Je)return Le*De}else Le!==-1&&(Ue-=Ue-Le),Le=-1}else for(V+Je>ke&&(V=ke-Je),Ue=V;Ue>=0;Ue--){let Le=!0;for(let rt=0;rt<Je;rt++)if(Et(Y,Ue+rt)!==Et(j,rt)){Le=!1;break}if(Le)return Ue}return-1}m.prototype.includes=function(j,V,oe){return this.indexOf(j,V,oe)!==-1},m.prototype.indexOf=function(j,V,oe){return ae(this,j,V,oe,!0)},m.prototype.lastIndexOf=function(j,V,oe){return ae(this,j,V,oe,!1)};function y(Y,j,V,oe){V=Number(V)||0;const me=Y.length-V;oe?(oe=Number(oe),oe>me&&(oe=me)):oe=me;const De=j.length;oe>De/2&&(oe=De/2);let ke;for(ke=0;ke<oe;++ke){const Je=parseInt(j.substr(ke*2,2),16);if(Bt(Je))return ke;Y[V+ke]=Je}return ke}function e(Y,j,V,oe){return we(It(j,Y.length-V),Y,V,oe)}function n(Y,j,V,oe){return we(Oe(j),Y,V,oe)}function s(Y,j,V,oe){return we(kt(j),Y,V,oe)}function l(Y,j,V,oe){return we(Ve(j,Y.length-V),Y,V,oe)}m.prototype.write=function(j,V,oe,me){if(V===void 0)me="utf8",oe=this.length,V=0;else if(oe===void 0&&typeof V=="string")me=V,oe=this.length,V=0;else if(isFinite(V))V=V>>>0,isFinite(oe)?(oe=oe>>>0,me===void 0&&(me="utf8")):(me=oe,oe=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const De=this.length-V;if((oe===void 0||oe>De)&&(oe=De),j.length>0&&(oe<0||V<0)||V>this.length)throw new RangeError("Attempt to write outside buffer bounds");me||(me="utf8");let ke=!1;for(;;)switch(me){case"hex":return y(this,j,V,oe);case"utf8":case"utf-8":return e(this,j,V,oe);case"ascii":case"latin1":case"binary":return n(this,j,V,oe);case"base64":return s(this,j,V,oe);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l(this,j,V,oe);default:if(ke)throw new TypeError("Unknown encoding: "+me);me=(""+me).toLowerCase(),ke=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function u(Y,j,V){return j===0&&V===Y.length?a.fromByteArray(Y):a.fromByteArray(Y.slice(j,V))}function b(Y,j,V){V=Math.min(Y.length,V);const oe=[];let me=j;for(;me<V;){const De=Y[me];let ke=null,Je=De>239?4:De>223?3:De>191?2:1;if(me+Je<=V){let Et,Ue,Le,rt;switch(Je){case 1:De<128&&(ke=De);break;case 2:Et=Y[me+1],(Et&192)===128&&(rt=(De&31)<<6|Et&63,rt>127&&(ke=rt));break;case 3:Et=Y[me+1],Ue=Y[me+2],(Et&192)===128&&(Ue&192)===128&&(rt=(De&15)<<12|(Et&63)<<6|Ue&63,rt>2047&&(rt<55296||rt>57343)&&(ke=rt));break;case 4:Et=Y[me+1],Ue=Y[me+2],Le=Y[me+3],(Et&192)===128&&(Ue&192)===128&&(Le&192)===128&&(rt=(De&15)<<18|(Et&63)<<12|(Ue&63)<<6|Le&63,rt>65535&&rt<1114112&&(ke=rt))}}ke===null?(ke=65533,Je=1):ke>65535&&(ke-=65536,oe.push(ke>>>10&1023|55296),ke=56320|ke&1023),oe.push(ke),me+=Je}return d(oe)}const x=4096;function d(Y){const j=Y.length;if(j<=x)return String.fromCharCode.apply(String,Y);let V="",oe=0;for(;oe<j;)V+=String.fromCharCode.apply(String,Y.slice(oe,oe+=x));return V}function r(Y,j,V){let oe="";V=Math.min(Y.length,V);for(let me=j;me<V;++me)oe+=String.fromCharCode(Y[me]&127);return oe}function v(Y,j,V){let oe="";V=Math.min(Y.length,V);for(let me=j;me<V;++me)oe+=String.fromCharCode(Y[me]);return oe}function N(Y,j,V){const oe=Y.length;(!j||j<0)&&(j=0),(!V||V<0||V>oe)&&(V=oe);let me="";for(let De=j;De<V;++De)me+=qe[Y[De]];return me}function O(Y,j,V){const oe=Y.slice(j,V);let me="";for(let De=0;De<oe.length-1;De+=2)me+=String.fromCharCode(oe[De]+oe[De+1]*256);return me}m.prototype.slice=function(j,V){const oe=this.length;j=~~j,V=V===void 0?oe:~~V,j<0?(j+=oe,j<0&&(j=0)):j>oe&&(j=oe),V<0?(V+=oe,V<0&&(V=0)):V>oe&&(V=oe),V<j&&(V=j);const me=this.subarray(j,V);return Object.setPrototypeOf(me,m.prototype),me};function se(Y,j,V){if(Y%1!==0||Y<0)throw new RangeError("offset is not uint");if(Y+j>V)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(j,V,oe){j=j>>>0,V=V>>>0,oe||se(j,V,this.length);let me=this[j],De=1,ke=0;for(;++ke<V&&(De*=256);)me+=this[j+ke]*De;return me},m.prototype.readUintBE=m.prototype.readUIntBE=function(j,V,oe){j=j>>>0,V=V>>>0,oe||se(j,V,this.length);let me=this[j+--V],De=1;for(;V>0&&(De*=256);)me+=this[j+--V]*De;return me},m.prototype.readUint8=m.prototype.readUInt8=function(j,V){return j=j>>>0,V||se(j,1,this.length),this[j]},m.prototype.readUint16LE=m.prototype.readUInt16LE=function(j,V){return j=j>>>0,V||se(j,2,this.length),this[j]|this[j+1]<<8},m.prototype.readUint16BE=m.prototype.readUInt16BE=function(j,V){return j=j>>>0,V||se(j,2,this.length),this[j]<<8|this[j+1]},m.prototype.readUint32LE=m.prototype.readUInt32LE=function(j,V){return j=j>>>0,V||se(j,4,this.length),(this[j]|this[j+1]<<8|this[j+2]<<16)+this[j+3]*16777216},m.prototype.readUint32BE=m.prototype.readUInt32BE=function(j,V){return j=j>>>0,V||se(j,4,this.length),this[j]*16777216+(this[j+1]<<16|this[j+2]<<8|this[j+3])},m.prototype.readBigUInt64LE=Se(function(j){j=j>>>0,Re(j,"offset");const V=this[j],oe=this[j+7];(V===void 0||oe===void 0)&&vt(j,this.length-8);const me=V+this[++j]*2**8+this[++j]*2**16+this[++j]*2**24,De=this[++j]+this[++j]*2**8+this[++j]*2**16+oe*2**24;return BigInt(me)+(BigInt(De)<<BigInt(32))}),m.prototype.readBigUInt64BE=Se(function(j){j=j>>>0,Re(j,"offset");const V=this[j],oe=this[j+7];(V===void 0||oe===void 0)&&vt(j,this.length-8);const me=V*2**24+this[++j]*2**16+this[++j]*2**8+this[++j],De=this[++j]*2**24+this[++j]*2**16+this[++j]*2**8+oe;return(BigInt(me)<<BigInt(32))+BigInt(De)}),m.prototype.readIntLE=function(j,V,oe){j=j>>>0,V=V>>>0,oe||se(j,V,this.length);let me=this[j],De=1,ke=0;for(;++ke<V&&(De*=256);)me+=this[j+ke]*De;return De*=128,me>=De&&(me-=Math.pow(2,8*V)),me},m.prototype.readIntBE=function(j,V,oe){j=j>>>0,V=V>>>0,oe||se(j,V,this.length);let me=V,De=1,ke=this[j+--me];for(;me>0&&(De*=256);)ke+=this[j+--me]*De;return De*=128,ke>=De&&(ke-=Math.pow(2,8*V)),ke},m.prototype.readInt8=function(j,V){return j=j>>>0,V||se(j,1,this.length),this[j]&128?(255-this[j]+1)*-1:this[j]},m.prototype.readInt16LE=function(j,V){j=j>>>0,V||se(j,2,this.length);const oe=this[j]|this[j+1]<<8;return oe&32768?oe|4294901760:oe},m.prototype.readInt16BE=function(j,V){j=j>>>0,V||se(j,2,this.length);const oe=this[j+1]|this[j]<<8;return oe&32768?oe|4294901760:oe},m.prototype.readInt32LE=function(j,V){return j=j>>>0,V||se(j,4,this.length),this[j]|this[j+1]<<8|this[j+2]<<16|this[j+3]<<24},m.prototype.readInt32BE=function(j,V){return j=j>>>0,V||se(j,4,this.length),this[j]<<24|this[j+1]<<16|this[j+2]<<8|this[j+3]},m.prototype.readBigInt64LE=Se(function(j){j=j>>>0,Re(j,"offset");const V=this[j],oe=this[j+7];(V===void 0||oe===void 0)&&vt(j,this.length-8);const me=this[j+4]+this[j+5]*2**8+this[j+6]*2**16+(oe<<24);return(BigInt(me)<<BigInt(32))+BigInt(V+this[++j]*2**8+this[++j]*2**16+this[++j]*2**24)}),m.prototype.readBigInt64BE=Se(function(j){j=j>>>0,Re(j,"offset");const V=this[j],oe=this[j+7];(V===void 0||oe===void 0)&&vt(j,this.length-8);const me=(V<<24)+this[++j]*2**16+this[++j]*2**8+this[++j];return(BigInt(me)<<BigInt(32))+BigInt(this[++j]*2**24+this[++j]*2**16+this[++j]*2**8+oe)}),m.prototype.readFloatLE=function(j,V){return j=j>>>0,V||se(j,4,this.length),f.read(this,j,!0,23,4)},m.prototype.readFloatBE=function(j,V){return j=j>>>0,V||se(j,4,this.length),f.read(this,j,!1,23,4)},m.prototype.readDoubleLE=function(j,V){return j=j>>>0,V||se(j,8,this.length),f.read(this,j,!0,52,8)},m.prototype.readDoubleBE=function(j,V){return j=j>>>0,V||se(j,8,this.length),f.read(this,j,!1,52,8)};function ce(Y,j,V,oe,me,De){if(!m.isBuffer(Y))throw new TypeError('"buffer" argument must be a Buffer instance');if(j>me||j<De)throw new RangeError('"value" argument is out of bounds');if(V+oe>Y.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(j,V,oe,me){if(j=+j,V=V>>>0,oe=oe>>>0,!me){const Je=Math.pow(2,8*oe)-1;ce(this,j,V,oe,Je,0)}let De=1,ke=0;for(this[V]=j&255;++ke<oe&&(De*=256);)this[V+ke]=j/De&255;return V+oe},m.prototype.writeUintBE=m.prototype.writeUIntBE=function(j,V,oe,me){if(j=+j,V=V>>>0,oe=oe>>>0,!me){const Je=Math.pow(2,8*oe)-1;ce(this,j,V,oe,Je,0)}let De=oe-1,ke=1;for(this[V+De]=j&255;--De>=0&&(ke*=256);)this[V+De]=j/ke&255;return V+oe},m.prototype.writeUint8=m.prototype.writeUInt8=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,1,255,0),this[V]=j&255,V+1},m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,2,65535,0),this[V]=j&255,this[V+1]=j>>>8,V+2},m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,2,65535,0),this[V]=j>>>8,this[V+1]=j&255,V+2},m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,4,4294967295,0),this[V+3]=j>>>24,this[V+2]=j>>>16,this[V+1]=j>>>8,this[V]=j&255,V+4},m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,4,4294967295,0),this[V]=j>>>24,this[V+1]=j>>>16,this[V+2]=j>>>8,this[V+3]=j&255,V+4};function fe(Y,j,V,oe,me){je(j,oe,me,Y,V,7);let De=Number(j&BigInt(4294967295));Y[V++]=De,De=De>>8,Y[V++]=De,De=De>>8,Y[V++]=De,De=De>>8,Y[V++]=De;let ke=Number(j>>BigInt(32)&BigInt(4294967295));return Y[V++]=ke,ke=ke>>8,Y[V++]=ke,ke=ke>>8,Y[V++]=ke,ke=ke>>8,Y[V++]=ke,V}function H(Y,j,V,oe,me){je(j,oe,me,Y,V,7);let De=Number(j&BigInt(4294967295));Y[V+7]=De,De=De>>8,Y[V+6]=De,De=De>>8,Y[V+5]=De,De=De>>8,Y[V+4]=De;let ke=Number(j>>BigInt(32)&BigInt(4294967295));return Y[V+3]=ke,ke=ke>>8,Y[V+2]=ke,ke=ke>>8,Y[V+1]=ke,ke=ke>>8,Y[V]=ke,V+8}m.prototype.writeBigUInt64LE=Se(function(j,V=0){return fe(this,j,V,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeBigUInt64BE=Se(function(j,V=0){return H(this,j,V,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeIntLE=function(j,V,oe,me){if(j=+j,V=V>>>0,!me){const Et=Math.pow(2,8*oe-1);ce(this,j,V,oe,Et-1,-Et)}let De=0,ke=1,Je=0;for(this[V]=j&255;++De<oe&&(ke*=256);)j<0&&Je===0&&this[V+De-1]!==0&&(Je=1),this[V+De]=(j/ke>>0)-Je&255;return V+oe},m.prototype.writeIntBE=function(j,V,oe,me){if(j=+j,V=V>>>0,!me){const Et=Math.pow(2,8*oe-1);ce(this,j,V,oe,Et-1,-Et)}let De=oe-1,ke=1,Je=0;for(this[V+De]=j&255;--De>=0&&(ke*=256);)j<0&&Je===0&&this[V+De+1]!==0&&(Je=1),this[V+De]=(j/ke>>0)-Je&255;return V+oe},m.prototype.writeInt8=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,1,127,-128),j<0&&(j=255+j+1),this[V]=j&255,V+1},m.prototype.writeInt16LE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,2,32767,-32768),this[V]=j&255,this[V+1]=j>>>8,V+2},m.prototype.writeInt16BE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,2,32767,-32768),this[V]=j>>>8,this[V+1]=j&255,V+2},m.prototype.writeInt32LE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,4,2147483647,-2147483648),this[V]=j&255,this[V+1]=j>>>8,this[V+2]=j>>>16,this[V+3]=j>>>24,V+4},m.prototype.writeInt32BE=function(j,V,oe){return j=+j,V=V>>>0,oe||ce(this,j,V,4,2147483647,-2147483648),j<0&&(j=4294967295+j+1),this[V]=j>>>24,this[V+1]=j>>>16,this[V+2]=j>>>8,this[V+3]=j&255,V+4},m.prototype.writeBigInt64LE=Se(function(j,V=0){return fe(this,j,V,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),m.prototype.writeBigInt64BE=Se(function(j,V=0){return H(this,j,V,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(Y,j,V,oe,me,De){if(V+oe>Y.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("Index out of range")}function ue(Y,j,V,oe,me){return j=+j,V=V>>>0,me||$(Y,j,V,4),f.write(Y,j,V,oe,23,4),V+4}m.prototype.writeFloatLE=function(j,V,oe){return ue(this,j,V,!0,oe)},m.prototype.writeFloatBE=function(j,V,oe){return ue(this,j,V,!1,oe)};function ge(Y,j,V,oe,me){return j=+j,V=V>>>0,me||$(Y,j,V,8),f.write(Y,j,V,oe,52,8),V+8}m.prototype.writeDoubleLE=function(j,V,oe){return ge(this,j,V,!0,oe)},m.prototype.writeDoubleBE=function(j,V,oe){return ge(this,j,V,!1,oe)},m.prototype.copy=function(j,V,oe,me){if(!m.isBuffer(j))throw new TypeError("argument should be a Buffer");if(oe||(oe=0),!me&&me!==0&&(me=this.length),V>=j.length&&(V=j.length),V||(V=0),me>0&&me<oe&&(me=oe),me===oe||j.length===0||this.length===0)return 0;if(V<0)throw new RangeError("targetStart out of bounds");if(oe<0||oe>=this.length)throw new RangeError("Index out of range");if(me<0)throw new RangeError("sourceEnd out of bounds");me>this.length&&(me=this.length),j.length-V<me-oe&&(me=j.length-V+oe);const De=me-oe;return this===j&&typeof i.prototype.copyWithin=="function"?this.copyWithin(V,oe,me):i.prototype.set.call(j,this.subarray(oe,me),V),De},m.prototype.fill=function(j,V,oe,me){if(typeof j=="string"){if(typeof V=="string"?(me=V,V=0,oe=this.length):typeof oe=="string"&&(me=oe,oe=this.length),me!==void 0&&typeof me!="string")throw new TypeError("encoding must be a string");if(typeof me=="string"&&!m.isEncoding(me))throw new TypeError("Unknown encoding: "+me);if(j.length===1){const ke=j.charCodeAt(0);(me==="utf8"&&ke<128||me==="latin1")&&(j=ke)}}else typeof j=="number"?j=j&255:typeof j=="boolean"&&(j=Number(j));if(V<0||this.length<V||this.length<oe)throw new RangeError("Out of range index");if(oe<=V)return this;V=V>>>0,oe=oe===void 0?this.length:oe>>>0,j||(j=0);let De;if(typeof j=="number")for(De=V;De<oe;++De)this[De]=j;else{const ke=m.isBuffer(j)?j:m.from(j,me),Je=ke.length;if(Je===0)throw new TypeError('The value "'+j+'" is invalid for argument "value"');for(De=0;De<oe-V;++De)this[De+V]=ke[De%Je]}return this};const W={};function Q(Y,j,V){W[Y]=class extends V{constructor(){super(),Object.defineProperty(this,"message",{value:j.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Y}]`,this.stack,delete this.name}get code(){return Y}set code(me){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:me,writable:!0})}toString(){return`${this.name} [${Y}]: ${this.message}`}}}Q("ERR_BUFFER_OUT_OF_BOUNDS",function(Y){return Y?`${Y} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Q("ERR_INVALID_ARG_TYPE",function(Y,j){return`The "${Y}" argument must be of type number. Received type ${typeof j}`},TypeError),Q("ERR_OUT_OF_RANGE",function(Y,j,V){let oe=`The value of "${Y}" is out of range.`,me=V;return Number.isInteger(V)&&Math.abs(V)>2**32?me=pe(String(V)):typeof V=="bigint"&&(me=String(V),(V>BigInt(2)**BigInt(32)||V<-(BigInt(2)**BigInt(32)))&&(me=pe(me)),me+="n"),oe+=` It must be ${j}. Received ${me}`,oe},RangeError);function pe(Y){let j="",V=Y.length;const oe=Y[0]==="-"?1:0;for(;V>=oe+4;V-=3)j=`_${Y.slice(V-3,V)}${j}`;return`${Y.slice(0,V)}${j}`}function $e(Y,j,V){Re(j,"offset"),(Y[j]===void 0||Y[j+V]===void 0)&&vt(j,Y.length-(V+1))}function je(Y,j,V,oe,me,De){if(Y>V||Y<j){const ke=typeof j=="bigint"?"n":"";let Je;throw j===0||j===BigInt(0)?Je=`>= 0${ke} and < 2${ke} ** ${(De+1)*8}${ke}`:Je=`>= -(2${ke} ** ${(De+1)*8-1}${ke}) and < 2 ** ${(De+1)*8-1}${ke}`,new W.ERR_OUT_OF_RANGE("value",Je,Y)}$e(oe,me,De)}function Re(Y,j){if(typeof Y!="number")throw new W.ERR_INVALID_ARG_TYPE(j,"number",Y)}function vt(Y,j,V){throw Math.floor(Y)!==Y?(Re(Y,V),new W.ERR_OUT_OF_RANGE("offset","an integer",Y)):j<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${j}`,Y)}const He=/[^+/0-9A-Za-z-_]/g;function Ke(Y){if(Y=Y.split("=")[0],Y=Y.trim().replace(He,""),Y.length<2)return"";for(;Y.length%4!==0;)Y=Y+"=";return Y}function It(Y,j){j=j||1/0;let V;const oe=Y.length;let me=null;const De=[];for(let ke=0;ke<oe;++ke){if(V=Y.charCodeAt(ke),V>55295&&V<57344){if(!me){if(V>56319){(j-=3)>-1&&De.push(239,191,189);continue}else if(ke+1===oe){(j-=3)>-1&&De.push(239,191,189);continue}me=V;continue}if(V<56320){(j-=3)>-1&&De.push(239,191,189),me=V;continue}V=(me-55296<<10|V-56320)+65536}else me&&(j-=3)>-1&&De.push(239,191,189);if(me=null,V<128){if((j-=1)<0)break;De.push(V)}else if(V<2048){if((j-=2)<0)break;De.push(V>>6|192,V&63|128)}else if(V<65536){if((j-=3)<0)break;De.push(V>>12|224,V>>6&63|128,V&63|128)}else if(V<1114112){if((j-=4)<0)break;De.push(V>>18|240,V>>12&63|128,V>>6&63|128,V&63|128)}else throw new Error("Invalid code point")}return De}function Oe(Y){const j=[];for(let V=0;V<Y.length;++V)j.push(Y.charCodeAt(V)&255);return j}function Ve(Y,j){let V,oe,me;const De=[];for(let ke=0;ke<Y.length&&!((j-=2)<0);++ke)V=Y.charCodeAt(ke),oe=V>>8,me=V%256,De.push(me),De.push(oe);return De}function kt(Y){return a.toByteArray(Ke(Y))}function we(Y,j,V,oe){let me;for(me=0;me<oe&&!(me+V>=j.length||me>=Y.length);++me)j[me+V]=Y[me];return me}function Ge(Y,j){return Y instanceof j||Y!=null&&Y.constructor!=null&&Y.constructor.name!=null&&Y.constructor.name===j.name}function Bt(Y){return Y!==Y}const qe=function(){const Y="0123456789abcdef",j=new Array(256);for(let V=0;V<16;++V){const oe=V*16;for(let me=0;me<16;++me)j[oe+me]=Y[V]+Y[me]}return j}();function Se(Y){return typeof BigInt>"u"?At:Y}function At(){throw new Error("BigInt not supported")}})(gd);const dr=gd.Buffer,za=gd.Buffer;function E1(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function d4(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function wd(t,...a){if(!d4(t))throw new Error("Uint8Array expected");if(a.length>0&&!a.includes(t.length))throw new Error("Uint8Array expected of length "+a+", got length="+t.length)}function N1(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function h4(t,a){wd(t);const f=a.outputLen;if(t.length<f)throw new Error("digestInto() expects output buffer of length at least "+f)}const qo=BigInt(2**32-1),I1=BigInt(32);function p4(t,a=!1){return a?{h:Number(t&qo),l:Number(t>>I1&qo)}:{h:Number(t>>I1&qo)|0,l:Number(t&qo)|0}}function m4(t,a=!1){let f=new Uint32Array(t.length),o=new Uint32Array(t.length);for(let c=0;c<t.length;c++){const{h:i,l:h}=p4(t[c],a);[f[c],o[c]]=[i,h]}return[f,o]}const v4=(t,a,f)=>t<<f|a>>>32-f,g4=(t,a,f)=>a<<f|t>>>32-f,b4=(t,a,f)=>a<<f-32|t>>>64-f,w4=(t,a,f)=>t<<f-32|a>>>64-f;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function y4(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}const C1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function x4(t){return t<<24&4278190080|t<<8&16711680|